Download the PHP package liam-wiltshire/laravel-model-meta without Composer

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

liam-wiltshire/laravel-model-meta

liam-wiltshire/laravel-model-meta is an extension to the default Laravel Eloquent model to add metadata to a model.

What MetaData?

While Eloquent is very good at handling relational data, however not all data we deal with works like this. Without going as far as using a NoSQL solution such as Mongo, using mySQL to hold relational data, but with a JSON meta field is a potential solution.

liam-wiltshire/laravel-model-meta allows you to use standard Eloquent getters and setters to add and remove metadata to your models. Any attributes that relate to a column in your database table will be handled as a standard attribute, but anything else will be added to the meta data.

This gives you great flexibility to have structured data where appropriate (for example an book will always have a title, author etc), but to then have other related, unstructured data (for example some books might have the number of pages, others might not)

When you are structuring your data, it's important to consider if you want to be able to query this data. Unless you use something like virtual columns at the DB level, this data isn't queryable - it's not designed to store the primary data for that record.

Example

This code would generate a new Test model and save it to the DB. Assuming that meta_subject is not a column in our table, the meta_subject will automatically be added to the metadata:

Installation

liam-wiltshire/laravel-model-meta is available as a composer package: composer require liam-wiltshire/laravel-model-meta

Once installed, use the \LiamWiltshire\LaravelModelMeta\Concerns\HasMeta trait in your model.

The database table behind the model will need a meta column adding - by default the trait assumes this will be called meta:

If the name of your meta column is different, then add a $metaDbField property to your model containing the name of the field:


All versions of laravel-model-meta with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
illuminate/database Version ^5.5.0|^6.0|^7.0|^8.0|^9.0|^10.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 liam-wiltshire/laravel-model-meta contains the following files

Loading the files please wait ....