Bootstrap Laravel 5 Packages with Bootpack

Packages

October 18th, 2017

bootpack.png

Bootpack is a Laravel 5 package bootstraper by Erik Campobadal that helps you create new Laravel 5 packages with the following features:

  • Creates composer.json for a laravel package
  • Create a basic well-structured package directory
  • Adds the local autoloader to the project composer.json
  • Dumps the autoload
  • Adds the package service provider to the laravel project
  • Initiates a git repository

Once installed you can use it with the following command to create a new package:

1php artisan bootpack:create LaravelNews/example

The Bootpack command will walk you through setting up your package, including adding a LICENSE, a starter README, translations, and migrations. You can remove and modify the folders that are relevant to your project.

Here’s an example starter project structure once you walk through the guided setup:

1packages/LaravelNews
2└── example
3 ├── composer.json
4 ├── LICENSE
5 ├── README.md
6 └── src
7 ├── Assets
8 │   └── README.md
9 ├── Classes
10 │   ├── ExampleClass.php
11 │   └── README.md
12 ├── Commands
13 │   ├── ExampleCommand.php
14 │   └── README.md
15 ├── Config
16 │   └── example.php
17 ├── Contracts
18 │   ├── ExampleContract.php
19 │   └── README.md
20 ├── Controllers
21 │   ├── ExampleController.php
22 │   └── README.md
23 ├── ExampleServiceProvider.php
24 ├── Middleware
25 │   ├── ExampleMiddleware.php
26 │   └── README.md
27 ├── Migrations
28 │   ├── 2017_08_11_171401_create_Example_table.php
29 │   └── README.md
30 ├── Routes
31 │   ├── api.php
32 │   ├── README.md
33 │   └── web.php
34 ├── Translations
35 │   ├── en
36 │   │   └── basic.php
37 │   └── README.md
38 └── Views
39 ├── README.md
40 └── sample.blade.php

Check out the bootpack repository for more information on Bootpack to quickly start developing a new package in your Laravel 5 projects.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.