zencodex / package-make
create separate laravel package/plugin
Installs: 55
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 3
Open Issues: 1
Type:package
Requires
- php: ^7.1|^8.0
Requires (Dev)
- orchestra/testbench: ^4.0
- phpunit/phpunit: ^8.0
README
package-make was abandon, please use packagit:
https://github.com/packagit/packagit
Create PHP or laravel package/plugin
You can manage huge project with many separate laravel packages.
Thanks to nwidart/laravel-modules
, I get many code from it and reimplement.
Why I re-implement (don't use nwidart/laravel-modules
)?
nwidart/laravel-modules
stubs injectedmodule_path
, you can't remove it in production.- Just a standard composer package, you don't need
nwidart/laravel-modules
to manage modules. - Update some stubs and folders structure, keep it like laravel.
- You can remove this package in production, Just required in devepopment.
So I seperate new one zencodex/package-make
, resovled above issues.
Installation
You can install the package via composer:
composer require --dev zencodex/package-make
Usage
// modules/NewPackage php artisan package:make NewPackage
NewPackage structure:
modules/NewPackage
├── Config
│ └── config.php
├── Console
│ └── UserCommand.php
├── Database
│ ├── Migrations
│ ├── Seeders
│ │ └── NewPackageDatabaseSeeder.php
│ └── factories
├── Http
│ ├── Controllers
│ │ └── NewPackageController.php
│ ├── Middleware
│ ├── Requests
│ └── Resources
│ └── UserResource.php
├── Models
│ └── User.php
├── Providers
│ ├── NewPackageServiceProvider.php
│ └── RouteServiceProvider.php
├── Resources
│ ├── assets
│ │ ├── js
│ │ │ └── app.js
│ │ └── sass
│ │ └── app.scss
│ ├── lang
│ └── views
│ ├── index.blade.php
│ └── layouts
│ └── master.blade.php
├── Routes
│ ├── api.php
│ └── web.php
├── Tests
│ ├── Feature
│ └── Unit
├── composer.json
├── package.json
└── webpack.mix.js
Custom namespace and path
php artisan vendor:publish --tag=package
// edit config/package.php // use namespace Balabala // generate package files in plugins folder return [ // Custom package namespace 'namespace' => 'Balabala', 'paths' => [ // Custom generated files path 'modules' => base_path('plugins'), // ...
Usage in project
option 1:
// app/Providers/AppServiceProvider.php use Package\NewPackage\Providers\NewPackageServiceProvider; class AppServiceProvider extends ServiceProvider public function register() { $this->app->register(NewPackageServiceProvider::class); ... }
or
Edit config/app.php
, add Package\NewPackage\Providers\NewPackageServiceProvider::class
to providers.
'providers' => [ Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, Package\NewPackage\Providers\NewPackageServiceProvider::class ... ],
option 2:
// 1. edit composer.json, add following "repositories": [ { "type": "path", "url": "modules/*" } ] // use private package or gitlab "repositories": [ { "type": "vcs", "url": "git@gitlab.example.com:/newpackage.git" } ] // 2. composer require local path package (replace package/newpackage to yours) composer require package/newpackage
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email v@yinqisen.cn instead of using the issue tracker.
Credits
License
The Apache License 2. Please see License File for more information.