Build APIs for
Humans & AI
Simultaneously
Transform your Laravel Eloquent models into JSON:API endpoints and MCP servers automatically.
Zero boilerplate. Pure results. Future-ready architecture.
class PostRepository extends Repository
{
public static string $model = Post::class;
}Mcp::web('restify', RestifyServer::class);Install with AI
Copy this prompt and paste it into Claude, ChatGPT, or any AI assistant
## Install Laravel Restify in my Laravel project
Please help me install and set up Laravel Restify, a package that transforms Laravel Eloquent models into JSON:API endpoints and MCP servers for AI agents.
### Step 1: Install the package
Run this command in your terminal:
```shell
composer require binaryk/laravel-restify
```
### Step 2: Run the setup command
After installation, scaffold the API structure:
```shell
php artisan restify:setup
```
This command will:
- Publish the `config/restify.php` configuration file
- Create `providers/RestifyServiceProvider` and register it
- Create the `app/Restify` directory for repositories
- Generate an abstract `app/Restify/Repository.php` base class
- Scaffold `app/Restify/UserRepository` for immediate use
- Create `routes/ai.php` with commented MCP server configuration
### Step 3: Run migrations
Complete the setup by running migrations:
```shell
php artisan migrate
```
### Step 4: Test the API
Your API is now ready! Test it with:
```bash
GET /api/restify/users?perPage=10&page=1
```
### Step 5 (Optional): Enable MCP Server for AI Agents
To make your API accessible to AI agents like Claude Desktop:
1. Add the MCP server to your `config/ai.php` file:
```php
use Binaryk\LaravelRestify\MCP\RestifyServer;
use Laravel\Mcp\Facades\Mcp;
Mcp::web('restify', RestifyServer::class)
->middleware(['auth:sanctum'])
->name('mcp.restify');
```
2. Enable MCP tools in your repositories by adding the `HasMcpTools` trait:
```php
use Binaryk\LaravelRestify\MCP\Concerns\HasMcpTools;
#[Model(User::class)]
class UserRepository extends Repository
{
use HasMcpTools; // Enables MCP tools for AI agents
public function fields(RestifyRequest $request): array
{
return [
field('name')->required(),
field('email')->required(),
];
}
}
```
### Next Steps
After installation, please help me:
- Understand what was created during setup
- Learn how to create my first repository
- Test the API endpoints
- Optionally configure authentication with Sanctum
For more information, visit the Laravel Restify documentation at https://restify.binarcode.comThis prompt will guide an AI assistant to help you install and set up Laravel Restify in your project.
Write Once,
Deploy Everywhere
Transform your Laravel models into production-ready APIs and AI-compatible servers with zero configuration. The future of API development is here.
Automatically generates endpoints that follow JSON:API specifications with proper relationships, pagination, filtering, and sparse fieldsets.
{
"data": {
"id": "1",
"type": "posts",
"attributes": {
"title": "Laravel Restify",
"published_at": "2024-01-15"
},
"relationships": {
"author": {
"data": {"id": "1", "type": "users"}
}
}
}
}Built-in integration with Laravel's authorization system. Use policies for fine-grained access control on every endpoint.
class PostPolicy
{
public function index(User $user)
{
return $user->can('view posts');
}
public function store(User $user)
{
return $user->hasRole('admin');
}
}Complex queries, sorting, filtering, and search across relationships without any extra configuration.
GET /api/restify/posts?
filter[title]=Laravel&
filter[status]=published&
sort=-created_at&
include=author,comments&
page[size]=10Generate Model Context Protocol servers that allow AI agents to interact with your APIs using structured, type-safe tools.
// Enable MCP for AI agents
Mcp::web('restify', RestifyServer::class)
->middleware(['auth:sanctum'])
->name('mcp.restify');Start building in seconds. Just create a repository class pointing to your model and you're ready.
class UserRepository extends Repository
{
public static string $model = User::class;
// That's it! Full CRUD API ready 🚀
}Built specifically for Laravel, leveraging Eloquent ORM, Service Container, and all Laravel conventions.
// Works with Laravel middleware
Route::middleware('auth:sanctum')
->group(function () {
Route::restify();
}); Built by Developers,
for Developers
Laravel Restify is open source and community-driven. Join thousands of developers who are building the future of API development.
Open Source
MIT licensed, completely free, and transparently developed on GitHub with full source code access.
Star on GitHubDocumentation
Comprehensive guides, tutorials, and API reference with real-world examples and best practices.
Read DocsDiscussions
Get help, share ideas, and connect with other developers in our active GitHub Discussions community.
Join DiscussionBinarCode
Proudly maintained by BinarCode, a team passionate about Laravel and modern web development.
Visit WebsiteBuilt by Amazing Contributors
Laravel Restify is made possible by our incredible community of contributors who help make it better every day
Ready to build
amazing APIs?
Install Laravel Restify today and transform your API development experience with elegant, powerful, and intuitive tools.
Get started instantly with Composer package manager
Explore the source code and contribute