PHP code example of albertoarena / laravel-truss
1. Go to this page and download the library: Download albertoarena/laravel-truss 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/ */
albertoarena / laravel-truss example snippets
// config/truss.php
'connections' => [
'mysql' => [],
'modules' => ['excluded_tables' => ['module_jobs']],
],
// config/truss.php
'reveal_excluded' => env('TRUSS_REVEAL_EXCLUDED', env('APP_ENV', 'production') === 'local'),
use AlbertoArena\Truss\Facades\Truss;
$dbml = Truss::snapshot()
->only(['orders', 'order_lines'])
->focus('orders', depth: 1)
->compact()
->toDbml();
use AlbertoArena\Truss\Facades\Truss;
$payload = Truss::payload(); // the app's default connection
$payload = Truss::payload('reporting'); // or a specific managed one
'guidelines' => ['exclude' => ['albertoarena/laravel-truss/truss']],
'skills' => ['exclude' => ['truss-schema']],
// config/truss.php
'theme' => [
'fonts' => [
'sans' => 'Inter, system-ui, sans-serif',
],
'colors' => [
'light' => [
'accent' => '#3730a3',
'background' => '#ffffff',
],
'dark' => [
'accent' => '#a5b4fc',
'background' => '#0b1020',
],
],
],
bash
php artisan truss:doctor
php artisan truss:doctor --connection=mysql --format=json
php artisan truss:doctor --preset=strict --fail-on=warning
bash
php artisan truss:export # DBML to stdout
php artisan truss:export --format=json # dbml, json, csv, markdown, mermaid, llm, or html
php artisan truss:export --format=dbml --output=docs/schema.dbml
php artisan truss:export --tables=orders,order_lines # only these (config exclusions still apply)
php artisan truss:export --connection=mysql --exclude=telemetry
bash
# Fail the build if the committed schema file is out of date
php artisan truss:export --format=dbml --output=docs/schema.dbml --check
bash
php artisan truss:export --format=html --output=schema.html
php artisan truss:export --format=html --mermaid=cdn --output=schema.html # small file, needs a network
bash
php artisan boost:install