Laravel Package Boilerplate
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
README.md
composer.json

README.md

Laravel Package Boilerplate

Laravel 5 Package Boilerplate

Requirements

Laravel >=5.1
PHP >= 5.5.9 

Installation

  1. Make your vendor directory under your project's main vendor directory.

    cd vendor
    mkdir my-vendor
    
  2. Clone the package's boilerplate from github repo into your vendor's package directory.

    git clone https://github.com/sohelamin/laravel-package-boilerplate.git my-package
    
  3. Add your package dir to your project's main composer.json file.

    "psr-4": {
        "App\\": "app/",
        "MyVendor\\MyPackage\\": "vendor/my-vendor/my-package/src"
    }
    

Note: When you will submit your package to packagist.org for composer package then you don't need to follow above instruction #3.

  1. Add service provider into /config/app.php file.

    'providers' => [
        ...
    
        MyVendor\MyPackage\MyPackageServiceProvider::class,
    ],
  2. Navigate to your project directory and run.

    composer dump-autoload
    composer update
    

Usage

See the bellow snippets.

$myPackage = $this->app['MyPackageClass'];
echo $myPackage::sayHi();

##Author

Sohel Amin