This guide helps you upgrade Rest Generic Class to newer versions and migrate from older implementations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/charlietyn/rest-generic-class/llms.txt
Use this file to discover all available pages before exploring further.
Current Version
Rest Generic Class is currently at version 2.1.8.Requirements
System Requirements
- PHP: ^8.0 or higher
- Laravel: ^12.0 or higher
Upgrading the Package
Step 1: Update Composer
Update the package version in yourcomposer.json:
Step 2: Publish Updated Configuration
If the configuration structure has changed, republish the config file:Step 3: Clear Caches
Clear all relevant caches:Step 4: Test Your Application
Run your test suite to ensure compatibility:- Filtering with
operparameters - Relation loading
- Hierarchy queries (if used)
- Export functionality (if used)
- Permission checks (if using Spatie)
Migration Strategies
From Custom Implementation
If you’re migrating from a custom REST API implementation to Rest Generic Class:1. Model Migration
Update your models to extendBaseModel:
2. Service Layer
Create service classes extendingBaseService:
3. Controller Migration
Refactor controllers to extendRestController:
4. API Compatibility
Update API clients to use the new query format:From MongoDB to SQL (or vice versa)
MongoDB to SQL
SQL to MongoDB
Ensure you have
mongodb/laravel installed when using BaseModelMongo:Configuration Migration
Environment Variables
If upgrading from an older version, ensure your.env file includes new variables:
Config File Updates
Compare your existingconfig/rest-generic-class.php with the published version:
Optional Dependencies
Rest Generic Class suggests several optional packages. Install based on your needs:Excel Export
exportExcel() method
PDF Export
exportPdf() method
Permissions
Module Support
Compatibility Notes
Laravel 12.x
Rest Generic Class 2.1.8 requires Laravel 12.0 or higher. If you’re on an older Laravel version:- Upgrade Laravel first: https://laravel.com/docs/12.x/upgrade
- Then upgrade Rest Generic Class
PHP 8.0+
The package requires PHP 8.0 or higher. Ensure your server meets this requirement:Breaking Changes
While the package maintains backward compatibility where possible, be aware of:- Configuration structure changes - Always review config after updates
- New required constants - Some model constants may become required
- Deprecated methods - Check for deprecation notices in logs
Rollback Procedure
If you encounter issues after upgrading:1. Restore Previous Version
2. Restore Configuration
3. Clear Caches
4. Report Issue
Open an issue on GitHub with:- Your Laravel version
- Previous package version
- New package version
- Error messages
- Steps to reproduce
Testing After Migration
Create a comprehensive test checklist:- Basic CRUD operations work
- Filtering with
operfunctions correctly - Relations load properly
- Pagination works
- Hierarchy queries work (if used)
- Export functions work (if used)
- Permission checks pass (if using Spatie)
- Caching behaves as expected (if enabled)
- Multi-tenant isolation works (if applicable)
- Custom service methods still function
- Custom controller methods still function
Getting Help
If you encounter migration issues:- Check the Troubleshooting guide
- Review the FAQ
- Consult the API Reference
- Open an issue on GitHub
- Include:
- Laravel version
- Package version (before and after)
- PHP version
- Error messages with full stack traces
- Steps to reproduce the issue
Best Practices
Version Pinning
In production, pin to specific versions:^ or * in production to prevent unexpected updates.
Staging Environment
Always test upgrades in a staging environment before production:- Deploy to staging
- Run full test suite
- Manually test critical endpoints
- Monitor for errors
- Only then deploy to production
Incremental Updates
If you’re several versions behind, update incrementally:Next Steps
After successful migration:- Review the Configuration overview for all options
- Check out Advanced filtering for powerful query features
- Optimize your implementation with the Caching guide
- Ensure security with the Security guide