Download the PHP package saintsystems/eloquent-transformable without Composer

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

Eloquent Transformable

Latest Version on Packagist Total Downloads Build Status

Work with your Laravel Eloquent models the way you want them to look (not as they are) using a simple transformation layer.

Installation

You can install the package in to any Laravel 5.8.* via composer:

Use Case

Laravel Eloquent is built on conventions. These conventions make certain assumptions like your primary keys being named id or the way foreign key columns should be named. You can override these conventions, but that requires a lot of configuration. Additionally, tools like Laravel Nova assume the default Eloquent conventions. Configuring Nova and Eloquent to use difference naming conventions then becomes a pain and your code becomes brittle because it is tied explicitly to your unconventional database naming standards.

Databases aren't always under our control. They may be managed by DBAs, could be third-party systems, or there may simply be a legacy database that doesn't adhere to Laravel's conventions that we don't want to change or can't change to make it conform to Laravel's conventions. This could be in the form of unconventional table names, column prefixes, column naming conventions, foreign key names, etc. We don't always control the database over which a Laravel app might sit.

Eloquent Transformable allows you to define how you would like the database columns to look with a simple transformation and then use your Eloquent Models as if they did adhere to Eloquent's naming conventions.

Transformable can also be used as a simple transformation layer to shield your application from the underlying database structure.

Usage

  1. Create a base Model.php class in your project and add the Transformable trait to it.

  2. Create a Model that represents your "Actual" database model.

Assuming a table definition of:

Table Name: tbl_Database_Table

Column Type
PK_Database_ID int
DB_Name varchar
FK_Foreign_Key_ID int
  1. Create a Model that represents your "Desired" database model.

  2. Use your new "Transformed" model the way you want to:

Benefits

Using Eloquent Transformable we can build our app around Laravel Eloquent's conventions and use our models as if the underlying database had been built to Laravel's conventions. If we have time and are able to move our database structure to Laravel's conventions eventually, we can simply remove the transformation from our models. This shields us from underlying database changes and allows us to control the appearance of our how our underlying database is exposed in our apps or apis.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of eloquent-transformable with dependencies

PHP Build Version
Package Version
Requires php Version >=7.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 saintsystems/eloquent-transformable contains the following files

Loading the files please wait ....