Skip to content

Sail Plugins #777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 16 commits into from
Closed

Sail Plugins #777

wants to merge 16 commits into from

Conversation

elnurvl
Copy link

@elnurvl elnurvl commented Mar 11, 2025

Add Plugin System to Laravel Sail for Extensible Docker Customization

Motivation and Problem

Laravel Sail currently requires direct codebase updates to support new services or runtime variations, such as adding specialized servers or tweaking existing ones like mysql or redis. As community demands grow, this approach increases maintenance overhead and bloats the core package with niche or non-essential features. This is evident from closed PRs trying to add new services or expand functionality, highlighting the challenge of balancing varied community requests.

Overview of the Plugin System

This PR introduces a plugin system that allows third-party packages to extend Sail’s Docker environment. Plugins can:

  • Define new services (e.g., an nginx server with HTTPS or an authorization server like Keycloak).
  • Override built-in services (e.g., custom mysql or redis configurations).
  • Inject additional logic into the artisan commands provided by Sail.

End developers can opt into plugins on-demand, tailoring their Docker setup while keeping Sail’s base minimal. See the documentation PR for implementation details and examples.

Why Build This Into Sail Rather Than a Standalone Tool?

I understand that the package maintainers aim to keep Sail simple and maintainable, as evidenced by closed PRs seeking to expand functionality, often accompanied by suggestions to fork the library instead. However, keeping this in a fork would defeat the proposal’s purpose, which is to prevent ecosystem fragmentation and spare developers the burden of managing separate Sail forks for their custom needs. The plugin system keeps Sail’s core behavior intact while enabling third-party packages to extend it externally, preserving a consistent and lightweight default experience.

How This Reduces Maintenance Overhead for Sail?

By offloading specialized or niche services to third-party plugins, Sail’s core remains focused on a reliable, streamlined Docker foundation. This reduces the need for frequent updates to accommodate every community request, as external packages can handle their own upkeep. Sail stays lean, maintainable, and adaptable without growing unwieldy.

Try It Out: Demo Plugin

To see the plugin system in action, check out this demo plugin: laravel-sail-plugin-demo. Try running php artisan sail:install in this sample Laravel project using the demo plugin: laravel-template (sail-plugin branch).

@elnurvl elnurvl marked this pull request as draft March 11, 2025 18:03
@elnurvl elnurvl force-pushed the plugins branch 5 times, most recently from e5c07cf to 4d6ba7a Compare March 12, 2025 01:17
@elnurvl elnurvl marked this pull request as ready for review March 12, 2025 23:43
@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

@elnurvl
Copy link
Author

elnurvl commented Mar 13, 2025

@taylorotwell , with so much effort put in, you’d expect more than a bot-like response. With due respect, it wouldn’t be frustrating and disresepctful if just five minutes were spent reading the PR description before closing it — a tiny fraction of the time I invested to present it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants