Download the PHP package mralston/laravel-eav without Composer

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

Laravel EAV

Introduction

Entity Attribute Value package for Laravel.

EAV Definition From Wikipedia:

Entity–attribute–value model (EAV) is a data model to encode, in a space-efficient manner, entities where the number of attributes (properties, parameters) that can be used to describe them is potentially vast, but the number that will actually apply to a given entity is relatively modest.

TL;DR this package allows you to work with attributes on your models which aren't defined in the underlying database schema.

But why though?

Your scientists were so preoccupied with whether or not they could that they didn't stop to think if they should.

-- Dr. Ian Malcolm (Jeff Goldblum), Jurassic Park

Truth be told, this started as a proof-of-concept based on an idea I had, aimed at improving a messy pre-existing implementation in several projects which I am involved in maintaining.

The EAV implementations which I've seen thus far have a separate database record for each EAV attribute. I believe that the bulk of the performance problems comes from the large amounts of additional database traffic as a result.

My concept is to place all of the EAV data into a JSON field in a single database record, which can be fetched just once per model instance.

Inspiration for using a JSON field came from Aaron Francis @ PlanetScale, so kudos to him. Also thanks to Aaron for the get-out-of-jail-free card when it comes to the 'you should just use a NoSQL database' argument.

Installation

Install the package using Composer:

Config

This package has no config, it doesn't need it. Yay!

Migrations

After installing, you need to migrate the package's single database table.

Usage

This package is designed to be completely transparent. You can read and write to model attributes just as you normally would.

Any model which you would like to use EAV will need to use the HasEntityAttributeValues trait:

Then all you need to do is set attributes on your model as you normally would:

If the attribute you set is defined as a field on the underlying table, it will be stored there as normal. Otherwise, it will be stored as an EAV attribute.

Other methods are also available which allow access to EAV data.

The eav method operates as a combined accessor and mutator, depending on whether it is passed the optional $value argument.

The underlying EAV store is assessable using the entityAttributeStore relationship. It provides get, set and unset methods:

A note on Persistence

EAV data is persisted to the database when you save the associated model. Until that time, any changes you make exist only on the model in memory - just like standard Eloquent attributes.

Likewise, if you instantiate several individual models of the same database record, each model instance will have its own distinct copy of the EAV attributes. You can modify an EAV attribute on one model instance and the others will remain unaffected - just like standard Eloquent attributes.

Security Vulnerabilities

Please e-mail security vulnerabilities directly to me.

Licence

PDF is open-sourced software licenced under the MIT license.


All versions of laravel-eav with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
illuminate/database Version ^10.0
illuminate/support Version ^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 mralston/laravel-eav contains the following files

Loading the files please wait ....