Download the PHP package orobogenius/laravel-model-statable without Composer

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

Laravel Model Statable

This package lets you add predefined states to your laravel models. This allows you to define states that can be applied to your models at various points in your application. You can define all your states in one place and transition your model instances into different states. For example, you may define an admin state that transforms a user into an admin.

Contents

Installation

Composer

To install this package via composer, simply run:

or just add:

to your composer.json file, then run composer install or composer udpate.

Usage

To add states to your laravel models, add the Orobogenius\Statable\Statable trait to the model.

This trait lets you apply predefined states to your model instances. To tell the package about the states that can be applied to your models, you first have to define them. States are defined as methods on your models. To define a state, prefix the model method with state.

Defined states should always return an array that is keyed by attributes on your model.

Applying states

For states that has been defined on your model, you may call the states method on your model instances and pass the state(s) that should be applied to the model:

You can, of course, apply more than one state to a model by passing in an array of states to the states method:

Closure attributes

You may add closure attributes to your model states definitions. The closure also receives the evaluated attributes of the enclosing states that define them:

Relationships

You may specify relationships and states to apply to those relationships in a model's state definition. This lets you to update related models when you apply certain states to model instances. For example, setting all invoice items to processed when an invoice is in a paid state. To add relations to a model's state definition, add a with_relations key to the array that is being returned from the state defintion. The value should be an array that specifies the relationship as a key and the states to apply as the value:

Invoice

InvoiceItem

The value of the relationship in the model definition can also be an array of states to be applied to the related models.

Testing

License

MIT license (MIT) - Check out the License File for more.


All versions of laravel-model-statable with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.4
illuminate/support Version ~5
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 orobogenius/laravel-model-statable contains the following files

Loading the files please wait ....