Download the PHP package purwantoid/package-generator without Composer
On this page you can find all versions of the php package purwantoid/package-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download purwantoid/package-generator
More information about purwantoid/package-generator
Files in purwantoid/package-generator
Package package-generator
Short Description Easy creation with Laravel package.
License
Informations about the package package-generator
Laravel Package Generator
Easy creation of Laravel packages with customizable stub templates.
Features
- Generate complete Laravel package structure
- Customizable stub templates for all generated files
- Support for conditional content (e.g., test files)
- Configurable template paths
- Automatic stub file discovery
- Template syntax validation
Installation
Usage
Basic Package Generation
Generate Package with Tests
Template System
The package generator uses external stub files for all templates, making it easy to customize the generated package structure.
Stub File Structure
Template Variables
All stub files support the following placeholder variables:
{{PACKAGE_NAME}}- Original package name{{PACKAGE_NAME_KEBAB}}- Package name in kebab-case{{PACKAGE_NAME_STUDLY}}- Package name in StudlyCase{{VENDOR_NAME}}- Original vendor name{{VENDOR_NAME_KEBAB}}- Vendor name in kebab-case{{VENDOR_NAME_STUDLY}}- Vendor name in StudlyCase{{NAMESPACE}}- Full namespace (VendorName\PackageName){{NAMESPACE_ESCAPED}}- Escaped namespace for JSON (VendorName\\PackageName){{COMPOSER_NAME}}- Composer package name (vendor-name/package-name){{CLASS_NAME}}- Main class name{{SERVICE_PROVIDER_CLASS}}- Service provider class name{{CURRENT_YEAR}}- Current year{{WITH_TESTS}}- Boolean indicating if tests should be included
Conditional Content
Stub files support conditional blocks for optional content:
Customizing Templates
You can customize the generated package structure by modifying the stub files in the stubs/ directory. Changes to stub files will be reflected immediately in newly generated packages.
Custom Stub Paths
You can configure custom paths for specific stub files:
Template Validation
The system includes built-in validation for template syntax:
Configuration
The package supports various configuration options for customizing the template system:
Stub Directory Configuration
Template Discovery
The system automatically discovers new stub files without requiring code changes:
Error Handling
The template system provides comprehensive error handling:
- Missing stub files: Clear error messages with troubleshooting steps
- Invalid template syntax: Detailed syntax validation with line numbers
- Undefined variables: Validation of required template variables
- File permissions: Graceful handling of permission errors
- Path security: Protection against path traversal attacks
Requirements
- PHP 8.3 or higher
- Laravel 9.0, 10.0, 11.0, or 12.0
- Illuminate Filesystem package
License
This package is open-sourced software licensed under the MIT license.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Changelog
Version 2.0.0
- Refactored to use external stub template system
- Added template syntax validation
- Improved error handling and user feedback
- Added support for conditional content blocks
- Implemented configurable template paths
- Added automatic stub file discovery
Version 1.0.0
- Initial release with hardcoded templates
All versions of package-generator with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0
illuminate/filesystem Version ^12.42