Download the PHP package moirei/laravel-model-data without Composer

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

laravel-model-data

This package allows you to access attribute fields in your model or use a data field without any changes to your migrations.

Features

Installation & Setup

You can install the package via composer;

Add the MOIREI\ModelData\HasData trait to your model;

Using the package's model

Optional if using a predefined attribute/column in your models.

Publish the migration with;

Run the migrate command to create the necessary table;

Mode 1: Persist data outside your model

This is the default mode if the $model_data property is falsy.

Mode 2: Persist data in your model

Define the data column (s) in your migration;

Then define a model_data variable in your model. This is the name of the storage column(s).

Usage

Accessing the data

The below uses data if in mode 1 or the value of $model_data is "data";

Basic access:

Access as arrays:

Calling as function.

All existing data can be overridden by assigning an array;

With get and set;

get with default:

Multiple/custom data fields (mode 2)

The above example uses data field which is the default for external mode. To allow multiple access with custom names,

Access with

Persisting data

Modify and save into a different model with

Collections

This packages supplies Collections functions pinch and save globally.

This means you can collect and save any data into any model that has the HasData trait;

The pinch function simply allows you to access a collection's underlying array using the dot notation.

The key option defaults to data.

Credits

License

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


All versions of laravel-model-data with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
illuminate/database Version ^5.6|^6.0|^7.0|^8.0
illuminate/support Version ^5.6|^6.0|^7.0|^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 moirei/laravel-model-data contains the following files

Loading the files please wait ....