Skip to content

Shipu/laratie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Package Development Boilerplate.

Features

  • Make package structure within a second
  • Adding package resource using command line
  • Easy way to define your package custom structure
  • Adding custom stubs facilities
  • Support Spatie Laravel Package Tools (Read More)
  • Support Filament Plugin Development (Read More)

Installation

Go to terminal and run this command

composer require shipu/laratie

Wait for few minutes. Composer will automatically install this package for your project.

For Laravel

Below Laravel 5.5 open config/app and add this line in providers section

Shipu\Tie\LaravelTieServiceProvider::class,

Now run this command in your terminal to publish this package resources:

php artisan vendor:publish --tag=tie-config

Quick Usages

Go to terminal and run this command with replace vendor to your username and package_name to your package name

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 ;

Package Resources

if you want to create your package resource then run below command:

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:

php artisan package:file vendor/package --controller=TestController

Available stubKey :

--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.

Package Root Directory

If you need to change your all packages root directory then Open config/tie.php and update root directory path.

'root'          => base_path('packages'), // Base directory

Pckage Owner

Open config/tie.php for setup your vendor name and rootNamespace. It's not mendatory.

'vendor'        => '', // Your github username. For Example 'vendor' => 'shipu'
'rootNamespace' => '', // Root Namespace For Example: 'rootNamespace'   => 'Shipu'

Package Structure

Open config/tie.php for setup your own package structure. Available configuration:

<?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'
        ]
        ...
    ]
    ...
];

Package Stub configuration

Open config/tie.php :

<?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
        ...
    ]
    ...
];

String Replacement

For replace string to another string on stub template. Open config/tie.php :

return [
    ...
    'stubs' => [
        ...
        'replace'   => [
            // ADD YOUR REPLACEMENT STRING. For Example:
            'REPLACEMENT_KEY'    => 'Replacement String',
            'VENDOR_NAME_LOWER'  => 'shipu',
            'VENDOR_NAME'        => 'Shipu',
        ],
        ...
    ]
    ...
];

Credits

Security Vulnerabilities

If you discover a security vulnerability within LaraTie, please send an e-mail to Shipu Ahamed via [email protected].

License

The LaraTie package is open-sourced software licensed under the MIT license.