Download the PHP package hxm/extrafield without Composer

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

Laravel 6.x/7.x/8.x Donate

HoanXuanMai — hxm/extrafield

This is a respository developed to add extra fields to models on Laravel projects.The hxm/extrafield package provides a simple and flexible way to add custom fields to your Laravel Eloquent models. With this package, you can easily define additional fields to store any type of data that you need, such as metadata, settings, or preferences. The extra fields are seamlessly integrated with the model attributes, allowing you to access and modify them using the same syntax as regular attributes. Moreover, the package offers convenient features such as default values, validation rules, and automatic casting to various data types. Whether you are building a small application or a large-scale system, hxm/extrafield can help you extend your models with ease and efficiency.

Instead of you needing to create additional columns on the existing database structure, you can simply use this respository.

Installation

Use [Composer] to install the package:

Use [Migration] to creating all tables:

you can also skip the migration by adding the following code in your AppServiceProvider.

Basic Usage

To be able to add extra fields to the Model we just need to implement the Interfaces into the Model Class. It comes with a built-in Trait so you can easily use it.

HXM\ExtraField\Contracts\CanMakeExtraFieldInterface The Model Class will share the same Additional Fields across instances

You will have a Trait dedicated to it: HXM\ExtraField\Traits\HasExtraFieldByInstance.

HXM\ExtraField\Contracts\CanMakeExtraFieldByInstanceInterface: The Model class will have its own Extra Fields on each instance, to be used as an intermediate Model class.

You will have a Trait dedicated to it: HXM\ExtraField\Traits\HasExtraFieldByInstance.

HXM\ExtraField\Contracts\CanMakeExtraFieldByInstanceInterface: used when there is a parent Model class, contact the current class, to be able to get the Extra Fields option depending on the child Model class

do not forget to add function public function getExtraFieldTargetTypeInstance(): CanMakeExtraFieldInterface, it will help the system know which relation you are using to access Extra Fields

Saving Extra Fields

Now, to add Extra Fields to the database, you just need to use actions directly on the controller in your admin

Don't worry, because there is a built-in validation system before the data is saved to the database.

Save Extra Field Values

HXM\ExtraField\Contracts\CanAccessExtraFieldValueInterface This contract stipulates on the Model class, where it can add values on the previously added list of Extra Fields

Attached to it are some pre-built Traits to ensure the structure: HXM\ExtraField\Traits\HasExtraFieldValue, HXM\ExtraField\Traits\AutoValidationAndSaveExtraFieldValue

HasExtraFieldValue there will be a 1-n relational function added to the Model, called extraValues()

AutoValidationAndSaveExtraFieldValue You use it so that the value is automatically saved for the Model class when you create or update it. Remember, it will come with a validation set before you can save the current Model. you may not use it, saving the value will be manually inserted another piece of code into your Controller

if you want to save it yourself, then remove the Trait from the Model class. the following code will help you to save manually by yourself:

Advanced

This repository is used with the hxm/enum package. So you can create your own EnumInstances for many structures on your system.

first, don't forget to publish the package's config file via the command:

This Enum class must implement from Interface: HXM\ExtraField\Contracts\ExtraFieldTypeEnumInterface, otherwise you will get an error when integrating it into the system

In addition, you can also customize the value handler when saving and retrieving from the database This Enum class must implement from Interface: HXM\ExtraField\Contracts\ExtraValueProcessValueInterface, otherwise you will get an error when integrating it into the system

License

Laravel User Agent is licensed under The MIT License (MIT).

Donations

Paypal

Contacts


All versions of extrafield with dependencies

PHP Build Version
Package Version
Requires php Version >=7
laravel/framework Version >=5
hxm/enum Version ^1.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 hxm/extrafield contains the following files

Loading the files please wait ....