Download the PHP
package drhtoo/laravel-metafield without Composer
On this page you can find all versions of the php package
drhtoo/laravel-metafield. It is possible to download/install
these versions without Composer. Possible dependencies are resolved
automatically.
Vendor drhtoo Package laravel-metafield Short Description Laravel MetaField License
MIT
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.
The Laravel Metafield package allows you to add custom metafields to your Laravel Eloquent models. This is useful when you need to store additional data about a model beyond its basic attributes.
Installation
To install the package, you can simply run the following Composer command:
Publishing Config and Migration (Optional)
After you've installed the package, you can optinally publish the package's config and migrations to your Laravel application. You can do this by running the following command:
Once the migrations have been published, you can run them by using the following command:
Usage
To start using the Laravel Metafield package, you'll need to add the HasMeta trait to any Eloquent models that you want to have metafields. Here's an example:
Now, you can use related meta fields by using relationship metas
MetaFields Property
To use meta fields as a model attribute, you have to add $metaFields property to your model. It is a protected property of array type which is the default values keyed by the field/key.
Attribute Casting
You can also cast the metafield as in attributes of Eloquent/Models.
Working with Livewire Component
This package is well compatible with Livewire component and directly bind to wire:model attribute. To be able to livewire component find the metafield attributes, you need to append the fields to model attributes.
Working with Spatie's Laravel-translatable Package
Laravel Meta Field works well with spatie/laravel-translatable package and you just simply add array item of meta field to $translatable property of your model and use setAttribute method of HasMeta trait insteadof Translatable.
That's all. Have fun.
All versions of laravel-metafield with dependencies
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 drhtoo/laravel-metafield contains the following files
Loading the files please wait ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.