sebastienheyd/boilerplate-packager

Generate and manage packages for sebastienheyd/boilerplate

1.6.0 2024-11-30 17:15 UTC

This package is auto-updated.

Last update: 2024-11-30 17:29:23 UTC


README

Version Downloads StyleCI Scrutinizer License

This package will allow you to easily create and manage your own local packages for sebastienheyd/boilerplate.

Installation

Via Composer

composer require sebastienheyd/boilerplate-packager --dev

Optionnal: publish configuration file

php artisan vendor:publish --tag=boilerplate-packager

Usage

By default, a help is displayed when calling boilerplate:packager without any argument.

php artisan boilerplate:packager

Create a new package

By default, every package will be generated using sebastienheyd/boilerplate-package-skeleton. Note that you can use a local path instead by setting the skeleton value in the configuration file.

You can also modify the default creation data (author, e-mail, description, license) by modifying the values in the configuration file

php artisan boilerplate:packager create

Or you can define the package name directly in the command line:

php artisan boilerplate:packager create my-vendor/my-package 

In this example, after asking some questions about author, email, description, license and resource, the command will load the skeleton package in a packages/my-vendor/my-package directory. Then, it will require the local package in your project, a symlink is created in the vendor directory pointing to the local package. All you have to do after that is to code in you freshly installed package.

Options

You can create a package with the option --dev to add the package to the require-dev section in composer.json

Require a package

You can require a package from packagist or by giving a git repository url.

php artisan boilerplate:packager require my-vendor/my-package
php artisan boilerplate:packager require https://github.com/my-vendor/my-package
php artisan boilerplate:packager require git@github.com/my-vendor/my-package

This will clone the package in the packages folder and require it via composer.

Options

You can require a package with the option --dev to add the package to the require-dev section in composer.json

Remove a local package

You can remove a local package by using the remove command. If you called the command without a package name you will be asked to chose the package to remove :

php artisan boilerplate:packager remove

You can also define directly the package name:

php artisan boilerplate:packager remove my-vendor/my-package 

This will remove the local package from your project. The command will ask to confirm the deletion of the local folder.

List local package

php artisan boilerplate:packager list

This will display a table with all local packages, installed or not.

Generate files for crud

This command will generate templates, controllers, views, menus, translations for the tables generated by the package.

To do this, after creating your package with the create command, create the migrations in the package and then run them to generate the tables in the database. After that, run the crud command indicating the package in which the migrations are located.

php artisan boilerplate:packager crud

You can also define directly the package name:

php artisan boilerplate:packager crud my-vendor/my-package 

It is possible that the foreign keys point to a model that is not in the package. The command will then ask you to enter the namespace related to the model needed for the relationship.

Be careful, if files already exist in the package they will be overwritten.

You can generate specified resources by using the option --only and one or many of the following keywords : model, routes, lang, permissions, controller, menu, views

php artisan boilerplate:packager crud my-vendor/my-package --only=views --only=routes

Sometimes your package will use prefixed tables, to avoid generating files with the prefix you can remove it by using the option --prefix

php artisan boilerplate:packager crud my-vendor/my-package --prefix=myprefix__

Test and coding standard

This package is delivered with tests, to launch tests just launch:

make test

Coding standard can also be checked by using phpcs:

make cs

Contributing

Please see contributing.md for details.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

MIT license. Please see the license file for more information.