Download the PHP package rougin/wildfire without Composer

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

Wildfire

Latest Version on Packagist Software License Build Status Coverage Status Total Downloads

Wildfire is a simple wrapper for the Query Builder Class based on Codeigniter 3. It is inspired from the Eloquent ORM of Laravel.

Installation

Install Wildfire via Composer:

Basic Usage

Prerequisites

Create a sample database table to be used (e.g., users):

Then configure the composer_autoload option in config.php:

[!NOTE] The value of composer_autoload should be the vendor directory (e.g., ciacme/vendor/autoload.php).

Next is to extend the model (e.g., User) to the Model class of Wildfire:

Using Wildfire

With CI_DB_query_builder

After configuring the application, the Wildfire class can now be used for returning results from the database as Model objects:

With CI_DB_result

Aside from using methods of Wildfire, raw SQL queries can also be converted to its Model counterpart:

Properties of Model class

The Model class provides the following properties that helps writing clean code and the said properties also conforms to the properties based on Eloquent ORM.

Casting attributes

Updating the $casts property allows the model to cast native types to the specified attributes:

Without native casts

With native casts

Notice that the value of accepted was changed from string integer ('0') into native boolean (false). If not specified (e.g. age field), all values will be returned as string except the id field (which will be automatically casted as native integer, also if the said column exists) by default.

Hiding attributes

To hide attributes for serialization, the $hidden property can be used:

Without hidden attributes

With hidden attributes

In this example, the gender field was not included in the result.

Visible attributes

Opposite of the $hidden property, the $visible property specifies the fields to be visible in the result:

Without visible attributes

With visible attributes

From the example, only the gender field was displayed in the result because it was the only field specified in the $visible property of the User model.

Using timestamps

Similar to Eloquent ORM, Wildfire enables the usage of timestamps by default:

When enabled, it will use the constants CREATED_AT and UPDATED_AT for auto-populating them with current timestamps. To modify the names specified in the specified timestamps, kindly create the specified constants to the model (e.g., User):

[!NOTE] Auto-populating of timestamps in the specified constants is used in WritableTrait.

Customizing attributes

When accessing an attribute through the model, Wildfire uses the same mechanism as from Eloquent ORM to return the requested attribute from the $attributes property. To customize the output of an attribute (e.g., converting an attribute to a date format), add a method inside the Model with a name format get_[ATTRIBUTE]_attribute:

After creating a method for the specified attribute, the Model class will call the said method (e.g., get_created_at_attribute) if the specified attribute is accessed (e.g., $user->created_at).

Using Traits

Wildfire provides traits that are based from the libraries of Codeigniter 3 such as Form Validation and Pagination Class. They are used to easily attach the specified functionalities of Codeigniter 3 to a model.

PaginateTrait

The PaginateTrait is used to easily create pagination links within the model:

The $result[0] returns the computed offset while $result[1] returns the generated pagination links:

To configure the pagination library, the $pagee property must be defined in the Model:

[!NOTE] Please see the documentation of Pagination Class to get the list of its available configuration.

ValidateTrait

This trait is used to simplify the specifying of validation rules to a model:

When used, the $rules property of the model must be defined with validation rules that conforms to the Form Validation specification:

[!NOTE] Kindly check its documentation for the available rules that can be used to the $rules property.

To do a form validation, the validate method must be called from the model:

If executed with a view, the validation errors can be automatically be returned to the view using the form_error helper:

WritableTrait

The WritableTrait is a special trait that enables the model to perform CRUD operations:

If added, the model can now perform actions such as create, delete, and update:

[!NOTE] When using this trait, the CREATED_AT and UPDATED_AT constants will be populated if the $timestamps property of a model is enabled.

WildfireTrait

Similar to WritableTrait, the WildfireTrait allows the model to use methods directly from the Wildfire class:

Adding it to a model enables the methods such as find and get methods without specifying the database table:

Migrating to the v0.5.0 release

The new release for v0.5.0 will be having a backward compatibility break (BC break). With this, some functionalities from the earlier versions might not be working after upgrading. This was done to increase the maintainability of the project while also adhering to the functionalities for both Codeigniter 3 and Eloquent ORM. Please see the UPGRADING page for the said breaking changes.

[!TIP] If still using the v0.4.0 release, kindly click its documentation below: https://github.com/rougin/credo/blob/v0.4.0/README.md

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

Credits

License

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


All versions of wildfire with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.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 rougin/wildfire contains the following files

Loading the files please wait ....