Download the PHP package marghoobsuleman/apiwizard without Composer
On this page you can find all versions of the php package marghoobsuleman/apiwizard. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package apiwizard
APIWizard - Laravel API Generator
A powerful Laravel package that generates models, relations, and complete REST APIs from an interactive command line interface or via command options.
โจ Features
- ๐ฏ Interactive CLI - User-friendly prompts guide you through the generation process
- ๐ Quick Generation - Create models, controllers, and routes in seconds
- ๐ Automatic Relations - Define and generate model relationships effortlessly
- ๐ Safe Updates - Add relations to existing models without overwriting code
- ๐จ Data Transformation - Optional transform methods for customizing API responses
- ๐ฆ Complete REST API - Generates full CRUD endpoints automatically
- โ๏ธ Non-Interactive Mode - Use command options for automation and scripting
- ๐ ๏ธ Customizable - Publish and modify stubs to match your coding style
- ๐ PSR-4 Compliant - Follows Laravel and PHP best practices
๐ Requirements
- PHP 8.2 or higher
- Laravel 11.x or 12.x
๐ฆ Installation
Install the package via Composer:
The package will automatically register its service provider.
Publish Configuration (Optional)
Publish Stubs (Optional)
๐ Usage
Available Commands
The package provides two commands (both work identically):
Interactive Mode
Run the command and follow the prompts:
Example Interactive Session:
Non-Interactive Mode
Use command options for automation:
Available Options:
| Option | Description | Example |
|---|---|---|
--table |
Table name (required for non-interactive) | --table=users |
--relations |
Relations in format "table:type" (can be used multiple times) | --relations=posts:hasMany --relations=profile:hasOne |
--endpoint |
API endpoint path | --endpoint=/api/users |
--transform |
Include transform method in model | --transform |
--no-api |
Skip API generation (model only) | --no-api |
Examples:
Generate model with multiple relations:
Generate model without API:
Simple model with API:
๐ What Gets Generated
1. Model File
Generated at app/Models/{ModelName}.php:
2. Controller File
Generated at app/Http/Controllers/API/{ModelName}Controller.php:
3. API Routes
Added to routes/api.php:
This creates the following endpoints:
GET /api/users- List all users (paginated)POST /api/users- Create a new userGET /api/users/{id}- Show a specific userPUT/PATCH /api/users/{id}- Update a userDELETE /api/users/{id}- Delete a user
โ๏ธ Configuration
After publishing the config file, you can customize:
๐จ Customizing Stubs
Publish the stubs and modify them to match your preferences:
Stubs will be published to stubs/apiwizard/:
model.stub- Model templatecontroller.stub- Controller template
๐ Supported Relation Types
- hasOne - One-to-one relationship
- hasMany - One-to-many relationship
- belongsTo - Inverse of one-to-many
- belongsToMany - Many-to-many relationship
๐ก Tips & Best Practices
-
Always review generated code - The package creates a solid foundation, but you should review and customize:
- Add proper validation rules in controllers
- Define fillable/guarded attributes in models
- Customize transform methods for your API responses
-
Use transform methods - They provide a clean way to control API output without cluttering controllers
-
Leverage non-interactive mode - Perfect for:
- CI/CD pipelines
- Seeding multiple models
- Scripted setups
- Customize stubs - Publish and modify stubs to match your team's coding standards
๐งช Testing
Run the tests with:
๐ Changelog
Please see CHANGELOG for more information on what has changed recently.
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
๐ License
The MIT License (MIT). Please see License File for more information.
๐ Credits
- Marghoob Suleman
- All Contributors
๐ Support
If you find this package helpful, please consider giving it a โญ๏ธ on GitHub!
Made with โค๏ธ for the Laravel community
All versions of apiwizard with dependencies
illuminate/support Version ^11.0|^12.0
illuminate/console Version ^11.0|^12.0
illuminate/filesystem Version ^11.0|^12.0
laravel/framework Version 11.*