Download the PHP package mannikj/laravel-sti without Composer

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

A single table inheritance trait for Eloquent

Latest Version on Packagist Build Status Total Downloads

This package provides a trait that makes your eloquent models capable of single table inheritance. If configured properly, queries will automatically return instances of the correct model subclasses according to the type column.

Installation

You can install the package via composer:

Basic Usage

Migration

The table you want to apply single table inheritance to must incorporate a type column.

The package's service provider adds a macro to the Blueprint class to create the type column.

Using the Trait

You need to add the SingleTableInheritance trait to your root model class. The sub models need to extend the root class.

For the default usage no other configuration is needed. The trait will use the class name of the subclasses as the type, scope the queries accordingly and return the correct instances of subclasses automatically.

Nested

If you have multiple levels of subclasses and you want the automatic scoping to include all sub types, you need to define the direct subclasses for each model by setting the stiSubClasses array property:

Advanced Usage

Types without fully-qualified classnames

Without any tweaking, the trait assumes that there is a type column storing the fully qualified names of the subclasses. However, if you want to use some other string not directly referencing a class as the type identifier, you can do so by overwriting two functions of the trait:

Resolving the type based on a related model

You can also tweak the behavior even further so that the type will be determined based on a related model:

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

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

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of laravel-sti with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 mannikj/laravel-sti contains the following files

Loading the files please wait ....