Download the PHP package bisual/laravel-shortcuts without Composer

On this page you can find all versions of the php package bisual/laravel-shortcuts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-shortcuts

Laravel Shortcuts for Software Agencies

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

Installation

You can install the package via composer:

You can publish and run the migrations with:

You can publish the config file with:

This is the contents of the published config file:

Optionally, you can publish the views using

Artisan generators

The package registers generators for repositories, DTOs, form requests, MCP tools, and a resource bundle. Generated PHP lives under the usual Laravel App\ namespaces. Controllers go to App\Http\Controllers\API.

make:repository

Creates a class in app/Repositories. The Repository suffix is added if you omit it.

Without --model, you get an empty final class. With --model=Post (or App\Models\Post), the class extends CrudRepository, sets $model, and includes @extends CrudRepository<Post>.

make:dto

Creates a final readonly class in app/DTOs. The name is normalized to a DTO suffix (RegisterUser and RegisterUserDTO both become RegisterUserDTO).

make:request-dto

Creates a matching DTO and a form request in app/Http/Requests. RegisterUser yields RegisterUserDTO plus RegisterUserRequest with empty rules(), authorize(): true, and a dto() method.

make:mcp-crud-resource

Requires laravel/mcp. Creates app/Mcp/Cruds/{Name}CrudMcp.php extending CrudMcpResource.

make:mcp-tool

Requires laravel/mcp. Creates a standalone custom tool in app/Mcp/Tools.

make:bisual-resource

Scaffolds an Eloquent model and optional companions. The name is the model (Post). If the model already exists, the command fails.

If you omit the name or flags, Laravel Prompts asks for the model name and which components to generate.

Flag Long name Generates
-c --controller App\Http\Controllers\API\PostController extending CrudController
-r --repository PostRepository bound to Post
-f --factory Laravel factory
-s --seeder Laravel seeder
-p --policy Laravel policy for the model
-d --dto StorePostDTO and UpdatePostDTO
-m --migration Laravel migration
--mcp App\Mcp\Cruds\PostCrudMcp
-a --all All of the above (including --mcp)

Factory, seeder, policy, migration, and the model itself are delegated to Laravel's make:* commands.

When -c and -d are used together, the command also runs make:request-dto for StorePost and UpdatePost, and the controller wires:

With -c and no -d, those properties are empty arrays (a minimal CRUD controller). Routes are not registered automatically.

MCP CRUD (CrudMcpResource)

Optional integration with Laravel MCP. Install it in the app:

Declare a resource the same way you declare a CrudController, then spread ::tools() into your MCP server:

toolsFrom() (and ::tools() for a single resource) auto-registers crud-query-guide once: the shared CrudRepository dialect (with / WHERE / scopes / append). Each *-index / *-show tool only lists the model catalog (allowed relations, scopes, filters) and points to that guide.

Property Role
$model / $repository Same as CrudController
$only / $except Which actions become MCP tools (index, show, store, update, destroy)
$authorize Whether each action calls the model Policy
$abilities Map action → Gate ability (defaults: viewAny, view, create, update, delete)
$indexQueryValidations Extra index rules (merged with the CrudRepository catalog)
$storeRequestClass / $updateRequestClass Array rules or FormRequest class
$descriptions Optional tool description overrides per action
$mcp_relation_depth Depth of relation tree documented for LLMs on index/show (default 2). Nesting is limited to roots in $mcp_with when set
$mcp_with Allowlist of eager-load relation roots or nested paths with .. for MCP (null = auto-discover, [] = none). Nested entries are documented as-is; enforcement allows any nesting under an allowed root.
$mcp_scopes Allowlist of local scopes the client may pass (null = auto, [] = none; hooks may still inject after enforcement)
$mcp_filterable Allowlist of column filters on index (null = fillable/casts/key, [] = none)
$rateLimitMaxAttempts / $rateLimitDecaySeconds Optional rate limit for CRUD MCP tools (null = off)
$extraTools Extra standalone tool classes mixed into ::tools()
prepareIndexParams / prepareStoreData / prepareUpdateData Hooks before the repository call
enforceMcpQueryAllowlists Rejects with / scopes / filters outside the allowlists (runs before prepareIndexParams)

Tool input schemas are built from CrudRepository::parameterDefinitions() (the reserved params index / show already understand), so LLMs see the same dialect as the HTTP API: with, order_by, page, per_page, limit, scopes, search, append, without, select, plus id for show/update/destroy. Additional column filters can still be passed through on index (same as the repository), constrained by $mcp_filterable when set.

Index/show tool descriptions list only the model catalog (relations / scopes / filters / searchable) and point to crud-query-guide for syntax. Prefer CrudMcpResource::toolsFrom([...]) so the guide is registered once when exposing several resources.

Example allowlists:

Custom authenticated tools

For non-CRUD tools, extend Bisual\LaravelShortcuts\Mcp\AuthenticatedMcpTool:

The pipeline is: authenticate → rate limit → validate rules() → authorize() → run(), with shared mapping of AuthorizationException / ValidationException / Throwable to Response::error. CRUD tools use the same pipeline under the hood.

Custom query params usage

You can build different formats of query params to handle sort, select and with in different depths of your query.

-- WITH --

To indicate depth within your query param 'with' you should use this format.

The '..' character indicates one level deeper.

-- ORDER BY --

You can simply indicate the field to order by entering it in your query as you have done all your life.

But you can also choose which fields of your relations to order and in which depth to do it, as well as indicate 'order_by_direction' in the same string.

_If you do not indicate your 'order_bydirection' with ':' next to the field to sort by, it will sort in 'asc' direction by default.

-- SELECT --

You can indicate a single field of your main table to get only that information (you don't need to add the id).

And once again, you can choose what information about your relationship you receive at the same time. Different fields of the same relationship level will be separated by '|'.

-- FILTER BY RELATION ATTRIBUTE --

You can filter parent rows by an attribute of a related model. The same value rules as for normal attribute filters apply (null, notnull, enums, comma-separated lists, booleans, numeric equality, or LIKE for strings).

BelongsTo / HasMany / similar relations use whereHas. MorphTo relations use whereHasMorph and only query morph types that actually have that column.

When you also pass with=relation and use the . form (relation.attribute=value), the constraint is applied both to parent existence and to the eager-loaded relation. The - form still filters parents, but does not constrain the eager load.

⚙️ Generalities

In all cases, to separate different relationships, regardless of the depth level, they must be separated by a ','.

NOTE: The query param 'order_by_direction' is not necessary when using laravel-shortcuts since it is applied directly in 'order_by', using it could cause errors.

Changelog

Please see CHANGELOG for more information on what has changed recently.

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-shortcuts with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/contracts Version ^13.0 | ^12.0 | ^11.0 | ^10.0 | ^9.0
spatie/laravel-package-tools Version ^1.14.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package bisual/laravel-shortcuts contains the following files

Loading the files please wait ...