In our daily life, we are going through lots of packages, and some of us don't know how to build our own package into Laravel.
We are going to perform the core steps to create your own package in Laravel. In this tutorial, we are going to build a zoom package, so we will perform steps related to it.
Setup Fresh Laravel Repo
Setup fresh Laravel repo, and then create directories within it.
For e.g. Create infyomlabs/zoom-api directory into root.
Now create src directory into zoom-api
Run Composer init Into src Directory
After hitting composer init it will ask some information from you, as you can see in below image I have entered some of information. you can just hit enter if you do not want to add other information.
Add your config file (Optional)
Create directory config into src directory and add your config.php file there from where you can manage your env variables.
Add Service Provider
Create your service provider from where you can do lots of actions. like you can publish config/routes/ migrations files from there. here we are publishing the zoom config file.
Add your class (Which contains all functions)
Here we have added a Zoom class which will be contained all zoom functions.
Finally, Test it in your existing project
Put the following code to your main composer.json (in your project's root). and hit composer update