Aliases package pre-release review

We plan to release another package. https://github.com/yiisoft/aliases this time.

There’s 100% test coverage, 100% MSI score so that’s pretty stable but extra pair of eyes would be great overall.

Also I’d like to know your opinion about getRoot(string $alias) method. Is it useful for you?

1 Like

Great!

I’ve a question. How should we configure aliases to be used inside config file?

Previously we had main.php such as:

<?php

return [
    'aliases' => [
        '@bower' => '@vendor/bower-asset',
        '@npm'   => '@vendor/npm-asset',
        '@publicUrl' => '/public/',
    ],

Now how will the config change?

It will be similar: https://github.com/yiisoft/yii-demo/blob/master/config/params.php#L21

What is the idea to accept both, file paths and URL as alias? I see this as big source of potential errors.

Wouldn’t it be safer to at least mark the two differently? Like @ for file paths and % (or something else) for URLs? Alternatively it could be made an convetion to add a Url as suffix for all URL aliases.

My biggest worry is, that the familiar @web alias now contains the base URL. @baseUrl would be much less confusing for poor yii2 veterans like me.

Alias could be any path-like string. I see no reason to mark these differently for two specific types.

A list of all default aliases would help, I think, but yes, this one could be renamed.