Download the PHP package jsefton/laravel-virtual-fields without Composer

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

Laravel Virtual Fields

Allow eloquent models to store and retreive data against anything without needing a specific database column.

Virtual Fields hook into eloquent attribute fetching to allow it to use a specific field to map data but still support all the core features of eloquent and a hybrid of virtual and physical fields in a database table.

Installation

Usage & Requirements

Virtual Fields is a trait that you can use in any eloquent model. e.g.

For virtual fields to work the database table for the desired model must have a field called data. You should add this through a migration for each model / table you wish to use Virtual Fields.

Once you have created a migration you will want something similar to the below to add the new field and handle removing in the down method.

The reason for data field to be a longText is to support long term usage of Virtual Fields. If you keep adding new data to store via Virtual Fields it will end up with a large JSON object within this column. If you know it is only going to be used for a small amount of data then please make your migration use a suitable data type.

Example

Once setup you can simply use normal attribute getting & setting against a model. This will automatically be handled when being saved into the database againt the model and converted back to actual attributes on query.

In this example we have a Post and a virtual field of sub_title. This field does not exist as a physical field in the database schema.

The sub_title will be saved in the data field mapped as an array with sub_title key and Example post sub title as a value.

When you want to get the value back out to use you simply use it like any normal eloquent attribute:

Please note currently for Laravel 7+ until tested and verified in lower versions.

TODO


All versions of laravel-virtual-fields with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version >=7.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 jsefton/laravel-virtual-fields contains the following files

Loading the files please wait ....