Download the PHP package malsanyang/laravel-model-tools without Composer

On this page you can find all versions of the php package malsanyang/laravel-model-tools. 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-model-tools

Laravel Model Tools

Laravel model utilities for applications that expose UUID references while keeping internal database IDs private.

Features

Requirements

Installation

Install the package with Composer:

Laravel discovers the package service provider automatically.

Publish the configuration file if you want to change the reference column or route model binding behaviour:

Usage

Add the HasReference trait to an Eloquent model:

Generate and run a migration for the model's table:

The generated migration adds the following column:

When a model is created or updated without a reference, the trait assigns a UUID automatically:

The trait checks that the configured column exists before assigning a UUID.

Finding Models by Reference

Return the matching model or null:

Return the matching model or throw an Eloquent ModelNotFoundException:

Configuration

The published config/model-tools.php file contains:

Custom Reference Column

Change reference_column to use a different column throughout the package:

The migration command uses the configured column by default. You can also override the generated migration's column explicitly:

Ensure the generated column name matches the column resolved by the model.

For a model-specific column, override the trait methods on that model:

Route Model Binding

Models using HasReference use the configured reference column for implicit route model binding by default:

Given the default configuration, Laravel resolves {page} using the model's reference value instead of its internal ID.

Disable this globally if you want Laravel to use the model's normal route key:

Optional Base Model

Applications that want shared defaults can extend the package base model:

Using the trait directly is recommended when you want more control over your model's behaviour.

Development

Install the development dependencies:

Run formatting checks, static analysis, and tests:

Run the complete CI suite, including Composer validation and the dependency security audit:

Individual checks are also available:

Security

Please report vulnerabilities privately by following the instructions in the security policy. Do not disclose security issues through public GitHub issues.

License

Laravel Model Tools is open-source software licensed under the MIT License.


All versions of laravel-model-tools with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.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 malsanyang/laravel-model-tools contains the following files

Loading the files please wait ...