Tricks

Quick Step Plugin Development

Jun 2, 2022
Blackpig
Integration, Admin panel

A Simple bullet point list to help get you started with plugin development.

  1. Use the Spatie Laravel Package Skeleton template repo as the template for a new repo in your account.
  2. Clone the new repo to your computer.
  3. Follow the configuration instructions from Spatie (running a command).
  4. Require filament/filament via Composer.
  5. Open your IDE and make sure that the ServiceProvider extends the FilamentServiceProvider instead of the PackageServiceProvider.
  6. Install the package locally in a Laravel-project with Filament (Admin) (via composer.json).
  7. Read the Filament docs on plugin development and have fun 😎

Thanks to @ralphjsmit

Also, a quick gotcha, if you're still on Laravel 8, you'll need to edit the composer.json of the Spatie package to read:

"illuminate/contracts": "^8.0|^9.0"

Thanks to @oyepez003

avatar

Hello,

One question please.

In your point 5, you said "Open your IDE and make sure that the ServiceProvider extends the FilamentServiceProvider instead of the PackageServiceProvider."

But, in the Filament Plugins documentation, they said "To create a new plugin, extend the Filament\PluginServiceProvider class provided by Filament:"

use Filament\PluginServiceProvider;
use Spatie\LaravelPackageTools\Package;
 
class ExampleServiceProvider extends PluginServiceProvider
{
public function configurePackage(Package $package): void
{
$package->name('your-package-name');
}
 
// ...
}

So, please, where is the truth ?

Thank you,