Skip to main content
Back to packages
675 GitHub stars

binarcode/laravel-restify

View on GitHub

Description

The first fully customizable Laravel JSON:API builder. "CRUD" and protect your resources with 0 (zero) extra line of code.

1. Setup the package:

php artisan restify:setup

2. Create your first repository:

php artisan restify:repository PostRepository --all

3. Enable MCP for AI agents (optional):

Add to your config/ai.php:

use Binaryk\LaravelRestify\MCP\RestifyServer;
use Laravel\Mcp\Facades\Mcp;
 
Mcp::web('restify', RestifyServer::class)
->middleware(['auth:sanctum'])
->name('mcp.restify');

That's it! Your API now serves both:

For Humans (JSON:API):

GET /api/restify/posts
POST /api/restify/posts
PUT /api/restify/posts/1
DELETE /api/restify/posts/1

For AI Agents (MCP):

GET /mcp/restify # Tool definitions and capabilities

Example Repository

use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
use Binaryk\LaravelRestify\Repositories\Repository;
use Binaryk\LaravelRestify\Attributes\Model;
 
#[Model(Post::class)]
class PostRepository extends Repository
{
public function fields(RestifyRequest $request): array
{
return [
field('title')->rules('required', 'string', 'max:255'),
textarea('content')->rules('required'),
field('author')->readonly(),
datetime('published_at')->nullable(),
];
}
}

This single definition automatically provides:

  • ✅ JSON:API CRUD endpoints with validation
  • ✅ MCP tools for AI agents with the same validation
  • ✅ Authorization policies applied to both interfaces
  • ✅ Search and filtering capabilities for all consumers

Related Content on Laravel Daily

Video

Recent Courses on Laravel Daily

Laravel 13 Eloquent: Expert Level

41 lessons
1 h 34 min

How to Build Laravel 13 API From Scratch

30 lessons
1 h 23 min

How to Structure Laravel 13 Projects

16 lessons
1 h 32 min read

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.