PHP code example of visualbuilder / eloquent-schema
1. Go to this page and download the library: Download visualbuilder/eloquent-schema library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
visualbuilder / eloquent-schema example snippets
// config/eloquent-schema.php
return [
// Cache TTL in seconds (0 to disable)
'cache_ttl' => env('ELOQUENT_SCHEMA_CACHE_TTL', 3600),
// Additional model paths to scan
'model_paths' => [
// app_path('Domain/Models'),
],
// Explicitly '
use Visualbuilder\EloquentSchema\Mcp\Tools\ListModels;
use Visualbuilder\EloquentSchema\Mcp\Tools\ModelSchema;
use Visualbuilder\EloquentSchema\Mcp\Tools\ModelFields;
class YourServer extends Server
{
protected array $tools = [
ListModels::class,
ModelSchema::class,
ModelFields::class,
];
}
use Visualbuilder\EloquentSchema\Services\ModelDiscoveryService;
use Visualbuilder\EloquentSchema\Services\ModelSchemaService;
// Discover models
$discovery = app(ModelDiscoveryService::class);
$models = $discovery->getModels(
bash
# List all available MCP tools
php artisan mcp:tools --list
# Describe a tool's parameters
php artisan mcp:tools ModelSchema --describe
# Call any MCP tool with arguments
php artisan mcp:tools GetConfig --args='{"key":"app.name"}'
php artisan mcp:tools ListModels
php artisan mcp:tools DatabaseSchema --args='{"filter":"users"}'
php artisan mcp:tools ModelSchema --args='{"model":"App\\Models\\Order","max_depth":1}'
bash
php artisan eloquent-schema:discover
bash
php artisan eloquent-schema:cache
bash
# Warm the cache (recommended after model changes)
php artisan eloquent-schema:cache
# Clear the cache when models change
php artisan eloquent-schema:clear --schema
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.