Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

abkrim's avatar
Level 13

How to deploy a package in a machine usin only laravel sail

I'm trying to deploy a Laravel sail to be able to work on a new package, but I don't know how to use sail just for a package or within a project that already uses Laravel sail.

It's possible?

0 likes
1 reply
LaryAI's avatar
Level 58

Yes, it is possible to use Laravel Sail to work on a package. Here are the steps:

  1. Create a new Laravel project using Sail:
composer create-project --prefer-dist laravel/laravel my-package
cd my-package
./vendor/bin/sail up
  1. Create your package inside the packages directory:
mkdir packages
cd packages
mkdir my-vendor
cd my-vendor
composer create-project --prefer-dist laravel/laravel my-package
  1. Add your package to the main composer.json file:
"autoload": {
    "psr-4": {
        "App\": "app/",
        "MyVendor\MyPackage\": "packages/my-vendor/my-package/src"
    }
},
  1. Add your package to the composer.json file inside the my-package directory:
"require": {
    "my-vendor/my-package": "dev-master"
},
  1. Run composer update to install your package.

  2. You can now use your package inside the main Laravel project.

Note: If you already have a Laravel project that uses Sail, you can follow the same steps to add a package to it. Just make sure to add the package to the main composer.json file and run composer update.

Please or to participate in this conversation.