jai/createpackage

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

artisan command to create laravel package .

v1.0 2015-05-17 20:47 UTC

This package is not auto-updated.

Last update: 2021-09-18 01:51:22 UTC


README

idea from Laracast Generators

Notes : at this stage very messy need to clean up

L5 includes an artisan command to create a laravel specific package out of the box, so this package only needs to add a few things, like:

  • php artisan create-package vendorName PackageName

Usage

Step 1: Install Through Composer

composer require jai/createpackages --dev

Step 2: Add the Service Provider

You'll only want to use these generators for local development, so you don't want to update the production providers array in config/app.php. Instead, add the provider in app/Providers/AppServiceProvider.php, like so:

Place Jai\Createpackages\CreatepackagesServiceProvider in config/app.php providers array.

for Local

public function register()
{
	if ($this->app->environment() == 'local') {
		$this->app->register('Jai\Createpackages\CreatepackagesServiceProvider');
	}
}

Step 3: Run Artisan!

You're all set. Run php artisan from the console, and you'll see the new command .

Examples

Create Package With Service Provider

php artisan create-package vendorName PackageName"

Done !! package will be created with service provider - now all you need to do is register this package with laravel and autolaod it

example consider you have run

php artisan create-package Jai example

Autoload your created package:

Add your package path to composer.json file in prs-4 so it looks like this

"psr-4": {
		"App\\": "app/",
		  "Jai\\Createpackages\\":"packages/jai/createpackage/src/"
		  }

Now in root console run : to autoload your package

composer dumpautoload

Now Registering Created package with laravel:

in root/config/app.php in providers array add

"Jai\Example\ExampleServiceProvider"

Test it : in ExampleServiceProvider.php - in boot function place

  dd("Testing package loading");
 after this  run laravel url - you should see this "Testing package loading".

###TODO :

-Extend this to load - routes -Extend this to load - config -Extend this to load - views -Extend this to load - model