1. Go to this page and download the library: Download firevel/includes 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/ */
firevel / includes example snippets
use Firevel\Includes\IncludesParser;
$with = app(IncludesParser::class)
->parseIncludes($request->input('.
return function ($relationship) use ($parameters) {
if (isset($parameters['limit'])) {
$relationship->limit((int) $parameters['limit']);
}
return $relationship;
};
// ...or return null to load the relationship "open" (no constraint).
});
$posts = Post::with($with)->paginate();
use Firevel\Includes\HasIncludes;
class Post extends Model
{
use HasIncludes;
// Optional allowlist. Omit it to accept any real relationship
// (validated against the model). Mirrors Fractal's $availableIncludes.
protected $availableIncludes = ['comments', 'comments.replies', 'author'];
// Optional policy. Default: every relationship is loaded "open".
// Override to apply your own per-relationship constraints.
protected function {
$relationship->where($filters);
}
if ($limit !== null) {
$relationship->limit((int) $limit); // per-parent on Laravel 11+
}
return $relationship;
};
}
}
$parser->setModel(Post::class); // instance or class string
return [
// Maximum dot-notation nesting depth, counted in segments.
'max_depth' => 5,
// 'ignore' to silently drop disallowed paths, 'throw' to raise an exception.
'on_disallowed' => 'ignore',
];
use Firevel\Includes\IncludesParser;
$with = (new IncludesParser(maxDepth: 3, onDisallowed: 'throw'))
->setAllowedIncludes(['comments'])
->parseIncludes($
bash
php artisan vendor:publish --tag=
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.