As a PHP developer, you may be interested in working with frameworks. Frameworks attempt to make the process of development easier by simplifying common practices used in the majority of developing web projects such as packages, modules, plug-ins, and even components (CakePHP).

Perhaps during the development process, you feel you are reinventing the wheel, such as when creating an Authentication or Captcha application. In this case, you need to create a package which will simplify and make your app development faster and easier.

There are two types of packages; some are framework independent (stand-alone) and the others are for a specific framework. This tutorial will exclusively cover Laravel packages.

Before creating a package you need to know about package managers. PEAR is a well-known PHP package manager which, although available, is rarely used. Why? It forced you to install packages system-wide, rather than on a project-by-project basis. Composer became PEAR’s successor.

What Are Laravel Packages?

One of the parameters for scaling framework power is how the developer redistributes useful packages of code. This allows developers to summarize applications into several packages of smaller applications.

Indeed, packages offer a great way to group related code. Packages are very similar to “Components”. It is important to note that the Laravel source code is a “package”, which Taylor Otwell calls the DEFAULT_BUNDLE.

One great advantage of Laravel packages is that they allow access to all the features the framework offers to its host application, including routing, migrations, tests, views, and numerous other useful features. Another important advantage of a package is the DRY (Don’t Repeat Yourself) principle. By creating a package for code you frequently use, you save resources and improve your application’s performance.