122 Extensions
bundle to a Web-accessible folder.
We recommend you use the second approach so that your extension can be more easily used by other people. Please refer to the Assets section for more details about how to work with assets in general.
Your extension may be used by applications supporting different languages! Therefore, if your extension displays content to end users, you should try to internationalize and localize it. In particular,
If the extension displays messages intended for end users, the messages should be wrapped into Yii::t() so that
they can be translated. Messages meant for developers (such as internal exception messages) do not need to be translated.
If the extension displays numbers, dates, etc., they should be formatted using [[yii\i18n\Formatter]] with appropriate formatting rules.
For more details, please refer to the Internationalization section.
You want your extension to run flawlessly without bringing problems to other people. To reach this goal, you should test your extension before releasing it to public.
It is recommended that you create various test cases to cover your extension code rather than relying on manual tests. Each time before you release a new version of your extension, you may simply run these test cases to make sure everything is in good shape. Yii provides testing support, which can help you to more easily write unit tests, acceptance tests and functionality tests. For more details, please refer to the Testing section.
You should give each release of your extension a version number (e.g. 1.0.1 ). We recommend you follow the semantic versioning practice when determining what version numbers should be used. To let other people know about your extension, you need to release it to the public. If it is the first time you are releasing an extension, you should register it on a Composer repository, such as Packagist. After that, all you need to do is simply create a release tag (e.g. v1.0.1 ) on the VCS repository of your extension and notify the Composer repository about the new release. People will then be able to find the new release, and install or update the extension through the Composer repository. In the releases of your extension, in addition to code files, you should also consider including the following to help other people learn about and use your extension: A readme file in the package root directory: it describes what your extension does and how to install and use it. We recommend you write it in Markdown format and name the file as readme.md .
A changelog file in the package root directory: it lists what changes are made in each release. The file may be written in Markdown format and named as changelog.md . An upgrade file in the package root directory: it gives the instructions on how to upgrade from older releases of the extension. The file may be written in Markdown format and named as upgrade.md . Tutorials, demos, screenshots, etc.: these are needed if your extension provides many features that cannot be fully covered in the readme file. API documentation: your code should be well documented to allow other people to more easily read and understand it.
Internationalization and Localization
Testing
Versioning
Releasing
123 ExtensionsInfo: Your code comments can be written in Markdown format. The yiisoft/yii2-apidoc extension provides a tool for
you to generate pretty API documentation based on your code comments.
Info: While not a requirement, we suggest your extension adhere to certain coding styles. You may refer to the core framework code style.
Yii provides the following core extensions that are developed and maintained by the Yii developer team. They are all registered on Packagist and can be easily installed as described in the Using Extensions subsection.
yiisoft/yii2-apidoc: provides an extensible and high-performance API documentation generator. It is also used to generate the core framework API documentation.
yiisoft/yii2-authclient: provides a set of commonly used auth clients, such as Facebook OAuth2 client, GitHub OAuth2 client.
yiisoft/yii2-bootstrap: provides a set of widgets that encapsulate the Bootstrap components and plugins.
yiisoft/yii2-codeception: provides testing support based on Codeception.
yiisoft/yii2-debug: provides debugging support for Yii applications. When this extension is used, a debugger toolbar will appear at the bottom of every page. The extension also provides a set of standalone pages to display more detailed debug information.
yiisoft/yii2-elasticsearch: provides the support for using Elasticsearch. It includes basic querying/search support and also implements the Active Record pattern that allows you to store active records in Elasticsearch.
yiisoft/yii2-faker: provides the support for using Faker to generate fake data for you.
yiisoft/yii2-gii: provides a Web-based code generator that is highly extensible and can be used to quickly generate models, forms, modules, CRUD, etc.
yiisoft/yii2-imagine: provides commonly used image manipulation functions based on Imagine.
yiisoft/yii2-jui: provides a set of widgets that encapsulate the JQuery UI interactions and widgets.
yiisoft/yii2-mongodb: provides the support for using MongoDB. It includes features such as basic query, Active Record, migrations, caching, code generation, etc.
yiisoft/yii2-redis: provides the support for using redis. It includes features such as basic query, Active Record, caching, etc.
yiisoft/yii2-smarty: provides a template engine based on Smarty.
yiisoft/yii2-sphinx: provides the support for using Sphinx. It includes features such as basic query, Active Record, code generation, etc.
yiisoft/yii2-swiftmailer: provides email sending features based on swiftmailer.
yiisoft/yii2-twig: provides a template engine based on Twig.