|
| 1 | +# Release Notes |
| 2 | + |
| 3 | +This document provides a high-level overview of major features and changes in Laravel Restify. For detailed documentation and implementation guides, please refer to the comprehensive documentation. |
| 4 | + |
| 5 | +## Version 10.x |
| 6 | + |
| 7 | +### 🚀 Major Features |
| 8 | + |
| 9 | +#### Model Context Protocol (MCP) Integration |
| 10 | + |
| 11 | +Laravel Restify now provides seamless integration with the Model Context Protocol (MCP), allowing AI agents to interact with your REST API resources through structured tool interfaces. Transform your repositories into tools for AI agents to consume! |
| 12 | + |
| 13 | +**Quick Setup:** |
| 14 | +```php |
| 15 | +use Binaryk\LaravelRestify\MCP\RestifyServer; |
| 16 | +use Laravel\Mcp\Facades\Mcp; |
| 17 | + |
| 18 | +// Web-based MCP server with authentication |
| 19 | +Mcp::web('restify', RestifyServer::class) |
| 20 | + ->middleware(['auth:sanctum']) |
| 21 | + ->name('mcp.restify'); |
| 22 | +``` |
| 23 | + |
| 24 | +**Key Benefits:** AI-Ready APIs, Zero Configuration, Built-in Security, Web & Terminal Access |
| 25 | + |
| 26 | +📖 **[Complete MCP Documentation →](docs-v2/content/en/mcp/mcp.md)** |
| 27 | + |
| 28 | +#### Lazy Relationship Loading for Fields |
| 29 | + |
| 30 | +Fields can now be configured to lazy load relationships, preventing N+1 queries for computed attributes: |
| 31 | + |
| 32 | +```php |
| 33 | +field('profileTagNames', fn() => $this->model()->profileTagNames) |
| 34 | + ->lazy('tags'), |
| 35 | +``` |
| 36 | + |
| 37 | +📖 **[Lazy Loading Documentation →](docs-v2/content/en/api/fields.md#lazy-loading)** |
| 38 | + |
| 39 | +#### JOIN Optimization for BelongsTo Search |
| 40 | + |
| 41 | +Performance optimization replacing slow subqueries with efficient JOIN operations. Enable via configuration: |
| 42 | + |
| 43 | +```php |
| 44 | +// config/restify.php |
| 45 | +'search' => [ |
| 46 | + 'use_joins_for_belongs_to' => env('RESTIFY_USE_JOINS_FOR_BELONGS_TO', false), |
| 47 | +], |
| 48 | +``` |
| 49 | + |
| 50 | +📖 **[Performance Optimization Guide →](UPGRADING.md#join-optimization)** |
| 51 | + |
| 52 | +#### Repository Index Caching |
| 53 | + |
| 54 | +Powerful caching system for repository index requests that can improve response times by orders of magnitude. Features smart cache key generation, automatic invalidation, and support for all major cache stores. |
| 55 | + |
| 56 | +```bash |
| 57 | +# Enable in .env |
| 58 | +RESTIFY_REPOSITORY_CACHE_ENABLED=true |
| 59 | +RESTIFY_REPOSITORY_CACHE_TTL=300 |
| 60 | +RESTIFY_REPOSITORY_CACHE_STORE=redis |
| 61 | +``` |
| 62 | + |
| 63 | +**Key Features:** |
| 64 | +- **Zero Configuration**: Works out of the box with any cache store |
| 65 | +- **Smart Invalidation**: Automatically clears cache on model changes |
| 66 | +- **User-Aware**: Respects authorization and user permissions |
| 67 | +- **Test Safe**: Disabled by default in test environment |
| 68 | +- **Store Agnostic**: Works with Redis, Database, File, and Memcached stores |
| 69 | + |
| 70 | +**Performance Impact:** |
| 71 | +- Complex queries: 50-90% faster response times |
| 72 | +- Large datasets: Significant database load reduction |
| 73 | +- Pagination: Near-instant subsequent page loads |
| 74 | + |
| 75 | +```php |
| 76 | +// Repository-specific configuration |
| 77 | +class PostRepository extends Repository { |
| 78 | + public static int $cacheTtl = 600; // 10 minutes |
| 79 | + public static array $cacheTags = ['posts', 'content']; |
| 80 | +} |
| 81 | +``` |
| 82 | + |
| 83 | +📖 **[Repository Caching Documentation →](docs-v2/content/en/performance/performance.md#repository-index-caching)** |
| 84 | + |
| 85 | +#### Enhanced Field Methods |
| 86 | + |
| 87 | +New and improved field methods with flexible signatures: |
| 88 | +- **`searchable()`** - Unified flexible signature with multiple argument support |
| 89 | +- **`matchable()`** - Various match types and advanced filtering scenarios |
| 90 | +- **`sortable()`** - Custom columns and conditional sorting |
| 91 | + |
| 92 | +#### Custom Search Callbacks for BelongsTo Relations |
| 93 | + |
| 94 | +BelongsTo fields now support custom search callbacks for complete control over search behavior: |
| 95 | + |
| 96 | +```php |
| 97 | +BelongsTo::make('user')->searchable(function ($query, $request, $value, $field, $repository) { |
| 98 | + return $query->whereHas('user', function ($q) use ($value) { |
| 99 | + $q->where('name', 'ilike', "%{$value}%") |
| 100 | + ->orWhere('email', 'ilike', "%{$value}%"); |
| 101 | + }); |
| 102 | +}) |
| 103 | +``` |
| 104 | + |
| 105 | +The callback receives all necessary parameters with the query as the first parameter for maximum flexibility. |
| 106 | + |
| 107 | +📖 **[Field Methods Documentation →](docs-v2/content/en/api/fields.md)** |
| 108 | + |
| 109 | +### ⚠️ Breaking Changes |
| 110 | + |
| 111 | +#### Default Search Behavior Change |
| 112 | + |
| 113 | +Repositories no longer search by primary key (ID) by default when no searchable fields are defined. |
| 114 | + |
| 115 | +**Migration Path:** |
| 116 | +```php |
| 117 | +public static function searchables(): array { |
| 118 | + return empty(static::$search) ? [static::newModel()->getKeyName()] : static::$search; |
| 119 | +} |
| 120 | +``` |
| 121 | + |
| 122 | +📖 **[Complete Migration Guide →](UPGRADING.md)** |
| 123 | + |
| 124 | +### 🔧 Technical Improvements |
| 125 | + |
| 126 | +- **Scout Integration**: Enhanced error handling and graceful degradation |
| 127 | +- **Column Qualification**: Improved handling for JOIN operations |
| 128 | +- **SearchablesCollection**: Fixed string callable handling |
| 129 | +- **Configuration**: New options with environment variable support |
| 130 | + |
| 131 | +## 📚 Documentation & Resources |
| 132 | + |
| 133 | +- **[Complete Documentation](docs-v2/content/en/)** - Comprehensive guides and examples |
| 134 | +- **[Migration Guide](UPGRADING.md)** - Step-by-step upgrade instructions |
| 135 | +- **[MCP Integration](docs-v2/content/en/mcp/mcp.md)** - AI agent setup and configuration |
| 136 | +- **[Field Reference](docs-v2/content/en/api/fields.md)** - All field methods and options |
| 137 | + |
| 138 | +## 🧪 Testing |
| 139 | + |
| 140 | +All new features include comprehensive test coverage to ensure reliability and maintainability. |
0 commit comments