mcpField
L
laravel-packages

laravel-packages

github.com/leeoveryDevelopment1552 installsUpdated 2w ago
Repository

About laravel-packages

A practical guide for Laravel package developers on deciding when to extract reusable code and structuring a package. It lists commonly used and optional dependencies along with their intended roles.

Key features

  1. 01Set criteria for package extraction
  2. 02Describe a package directory structure
  3. 03Recommend semantic versioning and independent tests
  4. 04List commonly used Spatie packages
  5. 05Cover optional Laravel packages

Use cases

  1. 01Assess whether shared code merits extraction
  2. 02Set up a Laravel package directory
  3. 03Choose DTO, state machine, or query dependencies
  4. 04Add authentication or tenancy packages when needed

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/leeovery/agentic-skills --skill laravel-packages

After installing, type/laravel-packagesin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
ExampleAction.php
ExampleBaseData.php
ExampleServiceProvider.php
package-extraction.md

Details

From the project README

Laravel Packages

Package development: extracting reusable patterns for use across projects.

Related guides:

When to Extract

Extract to package when:

  1. Pattern used in 3+ projects
  2. Code is stable and well-tested
  3. Pattern has clear boundaries
  4. Maintenance cost justified

→ Complete extraction guide: package-extraction.md

Package Structure

my-package/
├── src/
│   ├── PackageServiceProvider.php
│   ├── Actions/
│   ├── DTOs/
│   └── ...
├── tests/
├── composer.json
└── README.md

Use semantic versioning. Test packages independently. Document clearly.

Core Packages (Always)

Spatie Laravel Data
composer require spatie/laravel-data
  • DTOs with casting, validation, transformers
  • Test factory support
Spatie Model States
composer require spatie/laravel-model-states
  • State machine pattern
  • State transitions with dedicated classes
Spatie Query Builder
composer require spatie/laravel-query-builder
  • Filter, sort, include relations via query strings
  • API-friendly querying
Saloon
composer require saloonphp/saloon saloonphp/laravel-plugin
  • Elegant API client builder
  • Testable external service integrations
Pest
composer require pestphp/pest pestphp/pest-plugin-laravel --dev
  • Expressive testing framework
  • Architecture tests

Optional Packages

Laravel Sanctum
composer require laravel/sanctum

When: API authentication needed

Stancl Tenancy
composer require stancl/tenancy

When: Multi-tenant application

Spatie Settings
composer require spatie/laravel-settings

When: Application-level settings needed

Installation Commands

Full Install
composer require \
  spatie/laravel-data \
  spatie/laravel-model-states \
  spatie/laravel-query-builder \
  saloonphp/saloon \
  saloonphp/laravel-plugin

composer require \
  pestphp/pest \
  pestphp/pest-plugin-laravel \
  --dev

./vendor/bin/pest --init
Minimal Install
composer require spatie/laravel-data
composer require pestphp/pest pestphp/pest-plugin-laravel --dev
./vendor/bin/pest --init

Comments

Markdown supported