Contents
- Introduction
- Types of packages
- Characteristics of a package
- The Laravel package!
- Components of a Laravel package
- Example of a Laravel package
-
Creating your Laravel package
- 1- Package structure
- 2- Required equipments
- 3- Create package structure
- 4- Update package manifest
- 5- Create route
- 6- Create configuration file
- 7- Create command for package
- 8- Create controller
- 9- Create middleware
- 10- Create [database] migration
- 11- Create view
- 12- Create [view] assets
- 13- Create service provider
- 14- Create a manual/help file
- 15- Build our package
- 16- Test/Use our package
- Helpful information
In context of software development - particularly with PHP - a package is a modular, reusable piece of functionality that can be integrated into an application. Packages are designed to extend or enhance capabilities of a application by adding specific features or tools without reinventing wheel!
Now why packages? why not develop built-in codes and features?
Because:
Save time & effort - Instead of coding complex functionality (like payments, authn, or APIs), you use a well-tested package, by too many users (well-cooked)
Follow best practices - Good packages are built by experts(mostly), ensuring security, performance, and maintainability.
Easy updates - When a package improves, you get upgrades without rewriting your code. (composer update vendor/package)
Community-Powered - Many packages are open-source, meaning developers worldwide contribute to imptove them.
So let's avoid reinventing wheel!