Sunday, October 23, 2016

Create Package in Laravel 5.3 - Part I

So I have fresh laravel installation here... Then I'm gonna create a package example for my own need...:D
First let's create a new folder in our root directory, the folder name is "package" as shown below :
Next, let's create another folder inside of package. This folder will gonna be our name or vendor name then our package name [vendor or creator]/ [package name]
Next... let's add another folder called "src" :
Next,, open command prompt in windows, then go to that src folder, then type "composer init". Just follow the instruction :



Here is the result :
{my mistake, this composer.json should be outside of src folder >,<... So just move it outside like this :}

In order to make our package visible to laravel, we need to add some new config in laravel composer.json like this :
Execute "composer dump-autoload" to clear composer cache
Next is creating service-provider for our package,
Then... Move this HyosokaServiceProvider to src folder of our package :
Next,,, let's add HyosokaServiceProvider to laravel config provider :

Go to part II

No comments:

Post a Comment