Wallogit.com
2017 © Pedro Peláez
Laravel Package Boilerplate
Laravel Package Development Boilerplate. , (*2)
Go to terminal and run this command, (*3)
composer require shipu/laratie
Wait for few minutes. Composer will automatically install this package for your project., (*4)
Below Laravel 5.5 open config/app and add this line in providers section, (*5)
Shipu\Tie\LaravelTieServiceProvider::class,
Now run this command in your terminal to publish this package resources:, (*6)
php artisan vendor:publish --tag=tie-config
Go to terminal and run this command with replace vendor to your username and package_name to your package name, (*7)
php artisan package:create vendor package_name or php artisan package:create vendor/package_name or php artisan package:create
Then run composer dump-autoload;, (*8)
if you want to create your package resource then run below command:, (*9)
php artisan package:file vendor/package --stubkey=fileName or php artisan p:f vendor/package --stubkey=fileName
Suppose you want make a controller for your package then:, (*10)
php artisan package:file vendor/package --controller=TestController
Available stubKey :, (*11)
--controller --command --events --facades --config --migration --job --provider --routes --middleware --class --exceptions --key
If you have your own custom stubKey then you can choose --key for create package resource and value will be your stubKey., (*12)
If you need to change your all packages root directory then Open config/tie.php and update root directory path., (*13)
'root' => base_path('packages'), // Base directory
Open config/tie.php for setup your vendor name and rootNamespace. It's not mendatory., (*14)
'vendor' => '', // Your github username. For Example 'vendor' => 'shipu' 'rootNamespace' => '', // Root Namespace For Example: 'rootNamespace' => 'Shipu'
Open config/tie.php for setup your own package structure. Available configuration:, (*15)
<?php
return [
...
'stubs' => [
...
'structure' => [
'stubKey' => [
'namespace' => 'Namespace',
'case' => 'choose one from [lower, upper, snake, title, camel, kebab, studly']' // default studly
'path' => 'your_path/folderName',
'suffix' => 'FileNameSuffix',
'prefix' => 'PrefixFileName',
'extension' => 'file extension. dot php as default file extension'
'files' => [
// default file here
'default.extension',
'default.php',
'default.ini',
'default.jpg',
'PACKAGE_NAME.php'
]
],
// or
'stubKey' => 'your_path/folderName'
]
...
]
...
];
Open config/tie.php :, (*16)
<?php
return [
...
'stubs' => [
'path' => [
// adding more stub path for customize stub or new stub
base_path('vendor/shipu/laravel-tie/src/Consoles/stubs'),
],
'default' => [
// default folder structure with stub key
'composer',
'src',
'config',
//'provider', // laravel service provider
//'filament-plugin-provider', // please uncomment if you need filament plugin service provider
'spatie-provider', // spatie service provider. comment if you using filament plugin provider
'tests',
],
'root' => 'stubKey', // folder path which is concating with vendor/package on composer.json
...
]
...
];
For replace string to another string on stub template. Open config/tie.php :, (*17)
return [
...
'stubs' => [
...
'replace' => [
// ADD YOUR REPLACEMENT STRING. For Example:
'REPLACEMENT_KEY' => 'Replacement String',
'VENDOR_NAME_LOWER' => 'shipu',
'VENDOR_NAME' => 'Shipu',
],
...
]
...
];
If you discover a security vulnerability within LaraTie, please send an e-mail to Shipu Ahamed via shipuahamed01@gmail.com., (*18)
The LaraTie package is open-sourced software licensed under the MIT license., (*19)