Laravel Package Development Toolkit
A collection of specialized packages for extending Laravel functionality while adhering to framework conventions and modern PHP standards.
Core Package Types
- E-Commerce Systems: Implement inventory management/payment gateways using Laravel Cashier patterns and Eloquent relationships.
- API Tools: Build rate limiters with Laravel’s
ThrottleRequests
middleware and Redis-backed counters. - Multitenancy Solutions: Create tenant-aware services using database partitioning and isolated configs.
- GDPR Compliance: Leverage Laravel’s encryption and event auditing for data protection compliance.
Key Development Practices
- Modular Architecture:
- Use
src/
for core logic (search result) - Implement service providers/facades per Laravel’s IoC container
- Use
- Testing & CI:
- Write PHPUnit tests with Laravel’s testing helpers
- Use Composer scripts for test automation
- Documentation:
- Generate MkDocs/PHPDoc documentation
- Include installation/configuration guides
Technical Standards
- PHP 8.3+ Features:
- Enums for notification channels (WhatsApp/Telegram)
- Readonly properties in DTOs for GDPR packages
- Laravel Conventions:
- Follow folder structure:
packages/vendor/package/src
- Use
artisan vendor:publish
for configs
- Follow folder structure:
- Performance:
- Optimize event sourcing packages with lazy collections
- Cache SEO metadata using Laravel’s cache drivers
Integration Patterns
- Use Spatie’s package tools for headless CMS setups
- Extend Laravel Nova for analytics dashboards
- Implement Blade components for dynamic form builders
Overview of .cursorrules prompt
The .cursorrules file provides a comprehensive framework for developing a Laravel package. It includes specific development guidelines, such as using PHP 8.3+ features and adhering to Laravel conventions. The file emphasizes the use of the spatie/laravel-package-tools boilerplate, code styling through a default Pint configuration, and a focus on improving developer experience with features like autocompletion and type safety. Coding standards are outlined for naming conventions across different code elements. It also specifies the structure and organization of the package directory, explains the integration with a Laravel application, and details the strategies for testing and documenting the package. The guidelines suggest a detailed plan to meet the project description and requirements, ensuring the package is well-structured and follows best practices.