Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Api Crudify

Api Crudify Laravel Package

mehedi8gb/api-crudify

Laravel package that generates standardized API CRUD (controller/service/repository/model/requests/resources/tests) and powers query-driven endpoints via a chainable pipeline for relations, filtering, sorting, soft deletes, and pagination—all controlled by URL query params.

View on GitHub
Deep Wiki
Context7

Automate CRUD operations for Laravel APIs.

Frequently asked questions about Api Crudify
How do I generate a full CRUD API endpoint for a Laravel Eloquent model?
Run `php artisan crudify:make [ModelName]` to auto-generate a controller, service, repository, requests, resources, tests, and migrations. The package follows Laravel best practices with a Service-Repository pattern and registers API routes automatically. For example, `php artisan crudify:make Product` creates a full CRUD API for a `Product` model.
Does api-crudify support Laravel 9 or 10? What PHP version is required?
The package is designed for Laravel 8+ and likely requires PHP 8.0+. While the README doesn’t explicitly state Laravel 9/10 support, it uses modern Eloquent features like `readonly` properties and Artisan commands, which are compatible with newer Laravel versions. Test thoroughly if using Laravel 10.
Can I customize the query pipeline for filtering, sorting, or relations?
Yes, the package uses a Chain of Responsibility (CoR) pipeline for queries. You can extend or override base classes like `BaseQueryHandler` to add custom logic for filtering, sorting, or relations. For example, create a `CustomFilterHandler` and register it in the pipeline configuration. The `?q=`, `?where=`, and `?with=` query params are also fully customizable.
How does soft delete handling work with api-crudify?
Soft deletes are built-in via query params: `?trashed=with` includes soft-deleted records, while `?trashed=only` filters for them exclusively. The pipeline automatically handles soft delete logic in the `SoftDeleteHandler` without requiring manual code. This works seamlessly with Eloquent’s soft deletes and respects the `deleted_at` column.
Will this package conflict with existing controllers or services in my Laravel project?
The package includes an auto-restoration feature that detects and overwrites missing base classes (e.g., `BaseController`, `BaseService`) during `crudify:make`. If your project already has custom base classes, conflicts may arise. Review the generated files and manually merge or extend them to avoid overwrites. Consider backing up your project before installation.
Does api-crudify support API versioning (e.g., V1/, V2/) or tenant-aware queries?
The package supports nested namespaces like `V1/Inventory/Product` for domain-driven design, which aligns with API versioning. However, tenant-aware queries or multi-tenancy are not built-in. You’ll need to extend the pipeline or use middleware (e.g., `spatie/laravel-multitenancy`) alongside this package for tenant isolation.
How do I add custom validation rules or business logic to the generated CRUD endpoints?
Custom validation can be added by extending the auto-generated `FormRequest` classes (e.g., `CreateProductRequest`). For business logic, override the `BaseService` methods like `create()`, `update()`, or `delete()` in your custom service class. The package generates stubs for these methods, making it easy to inject your logic while retaining the pipeline’s benefits.
Are the auto-generated tests sufficient for production use?
The package generates feature tests using Laravel’s testing helpers (e.g., `JsonResponse::assert...`), but they may not cover edge cases like validation errors, concurrency, or complex query interactions. Extend the tests by adding custom assertions or scenarios. For critical applications, manually review and expand test coverage, especially for custom business logic.
Can I use api-crudify with a microservices architecture or is it monolithic?
While the package excels at monolithic Laravel APIs, its monolithic generation approach (all CRUD components at once) may not fit microservices. For microservices, consider using the package’s query pipeline selectively or building custom controllers/services. The Service-Repository pattern is still useful, but you’ll need to manually split components across services.
What alternatives exist if api-crudify feels too opinionated or lacks features?
For lighter-weight solutions, consider `spatie/laravel-query-builder` for dynamic filtering/sorting or `laravel-api-resource` for API responses. For full CRUD automation, `orchid/platform` or `backpack/crud` offer more customization but with heavier dependencies. If you need rate limiting, pair this package with `spatie/laravel-rate-limiting`. Evaluate your needs: api-crudify prioritizes standardization, while alternatives offer flexibility.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
ecotone/kafka
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata