Laravel 10 package development from scratch

Ivan Kolodii
4 min readApr 9, 2023

This article is an updated version of Laravel 7 package development article

Step 1. Create a new project

I prefer using the Laravel installer. You can read more about the installation here: https://laravel.com/docs/10.x/installation

laravel new lara-dg

I prefer using SQLite for testing and package development. Adjust your.env file

DB_CONNECTION=sqlite
DB_DATABASE=/Users/ivan/code/packages/test-project/database/database.sqlite

Then let’s create our package skeleton. We will be using a CLI tool. It will generate all necessary files

composer require jeroen-g/laravel-packager

Then you can run generation command. Webkid stands for vendor name(your namespace) and LaravelDiagnostic as the name of your project

php artisan packager:new Webkid LaravelDiagnostic --i

Then type information about your package and you. It should look like that

Console output

Now you have packages folder inside of your project with Webkid directory inside and all necessary files inside.

This package is automatically loaded via composer. I prefer using a relative path:

"repositories": {…

--

--