V
V
Vasiliy_M2018-01-17 10:24:07
linux
Vasiliy_M, 2018-01-17 10:24:07

Do I need to specify vendor_name/package_name when creating a package?

I got lost in three pines, although I thought that I knew everything.
When I was looking into composer, I was looking at third party packages on packagist.org and noticed a trend that packages are named as vendor_name/package_name :

"autoload-dev": {
        "psr-4": {
            "Vendor\\Library\\": "src"
        }
    },

which seemed quite logical to me - a supplier can have many packages.
Now I re-read PSR-4 and was surprised - it turns out that there is no such requirement anywhere - to indicate exactly this notation:
A fully qualified class name must have the following structure: \<Namespace>(\<SubNamespace>)*\<ClassName>
- roughly speaking, the standard requires only specifying the Supplier in the <Namespace>, and what <SubNamespace> will be - no one cares.
I looked at the yii sources and did not understand how they managed to ensure that they use a single top-level namespace - yii, although, in the app-base composer.json they have
"require": {
        "yiisoft/yii2": "~2.0.6",
        "yiisoft/yii2-bootstrap": "~2.0.0",
        "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0"
    },

those. in the use code should be yiisoft / yii22, but they just use yii
How did they achieve this and why does this go against the composer's ideology?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WapSter, 2019-11-03
@ProgerSoft

normalize || Reset CSS . Font rendering will still be different.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question