Commit bf6b2f0a by Alexander Makarov

Updated extension docs to be less restrictive about choosing namespace, more…

Updated extension docs to be less restrictive about choosing namespace, more neutral composer.json example
parent ee109a6f
...@@ -13,7 +13,7 @@ Code style ...@@ -13,7 +13,7 @@ Code style
- Do not use `yiisoft` in the namespaces. - Do not use `yiisoft` in the namespaces.
- Do not use `\yii`, `\yii2` or `\yiisoft` as root namespace. - Do not use `\yii`, `\yii2` or `\yiisoft` as root namespace.
- Use `vendor-name\type` namespace format (all lowercase) where type may be `widgets`, `behaviors`, `modules` etc. - Use `vendor-name` as the root namespace.
Distribution Distribution
------------ ------------
...@@ -63,16 +63,16 @@ If your extension classes reside directly in repository root use PSR-4 the follo ...@@ -63,16 +63,16 @@ If your extension classes reside directly in repository root use PSR-4 the follo
``` ```
{ {
"name": "samdark/yii2-iconized-menu-widget", "name": "myname/mywidget",
"description": "IconizedMenu automatically adds favicons in front of menu links", "description": "My widget is a cool widget that does everything",
"keywords": ["yii", "extension", "favicon", "menu", "icon"], "keywords": ["yii", "extension", "widget", "cool"],
"homepage": "https://github.com/samdark/yii2-iconized-menu-widget", "homepage": "https://github.com/myname/yii2-mywidget-widget",
"type": "yii2-extension", "type": "yii2-extension",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"authors": [ "authors": [
{ {
"name": "Alexander Makarov", "name": "John Doe",
"email": "sam@rmcreative.ru" "email": "doe@example.com"
} }
], ],
"require": { "require": {
...@@ -80,16 +80,16 @@ If your extension classes reside directly in repository root use PSR-4 the follo ...@@ -80,16 +80,16 @@ If your extension classes reside directly in repository root use PSR-4 the follo
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"samdark\\widgets\\": "" "myname\\mywidget\\": ""
} }
} }
} }
``` ```
In the above `samdark/yii2-iconized-menu-widget` is the package name that will be registered In the above `myname/mywidget` is the package name that will be registered
at [Packagist](https://packagist.org). It is common for it to match your github repository. at [Packagist](https://packagist.org). It is common for it to match your github repository.
We're using `psr-4` autoloader and mapping `samdark\widgets` namespace to the root directory where our classes reside. We're using `psr-4` autoloader and mapping `myname\mywidget` namespace to the root directory where our classes reside.
More details can be found in the [composer documentation](http://getcomposer.org/doc/04-schema.md#autoload). More details can be found in the [composer documentation](http://getcomposer.org/doc/04-schema.md#autoload).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment