1. Go to this page and download the library: Download rougin/wildfire library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rougin / wildfire example snippets
php
// ciacme/application/config/config.php
/*
|--------------------------------------------------------------------------
| Composer auto-loading
|--------------------------------------------------------------------------
|
| Enabling this setting will tell CodeIgniter to look for a Composer
| package auto-loader script in application/vendor/autoload.php.
|
| $config['composer_autoload'] = TRUE;
|
| Or if you have your vendor/ directory located somewhere else, you
| can opt to set a specific path as well:
|
| $config['composer_autoload'] = '/path/to/vendor/autoload.php';
|
| For more information about Composer, please visit http://getcomposer.org/
|
| Note: This will NOT disable or override the CodeIgniter-specific
| autoloading (application/config/autoload.php)
*/
$config['composer_autoload'] = __DIR__ . '/../../vendor/autoload.php';
php
// ciacme/application/models/User.php
use Rougin\Wildfire\Model;
class User extends Model
{
}
php
// ciacme/application/controllers/Welcome.php
use Rougin\Wildfire\Wildfire;
// Pass the \CI_DB_query_builder instance
$wildfire = new Wildfire($this->db);
// Can also be called to \CI_DB_query_builder
$wildfire->like('name', 'Royce', 'both');
// Returns an array of User objects
$users = $wildfire->get('users')->result();
php
// ciacme/application/controllers/Welcome.php
use Rougin\Wildfire\Wildfire;
$query = 'SELECT p.* FROM post p';
// Create raw SQL queries here...
$result = $this->db->query($query);
// ...or even the result of $this->db->get()
$result = $this->db->get('users');
// Pass the result as the argument
$wildfire = new Wildfire($result);
// Returns an array of User objects
$users = $wildfire->result('User');
php
// ciacme/application/models/User.php
class User extends \Rougin\Wildfire\Model
{
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = array('accepted' => 'boolean');
}
php
// ciacme/application/models/User.php
class User extends \Rougin\Wildfire\Model
{
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = array('gender');
}
php
// ciacme/application/models/User.php
class User extends \Rougin\Wildfire\Model
{
/**
* The attributes that should be visible for serialization.
*
* @var array
*/
protected $visible = array('gender');
}
php
// ciacme/application/models/User.php
class User extends \Rougin\Wildfire\Model
{
/**
* Allows usage of timestamp fields ("CREATED_AT", "UPDATED_AT").
*
* @var boolean
*/
protected $timestamps = true;
}
php
// ciacme/application/models/User.php
class User extends \Rougin\Wildfire\Model
{
/**
* @return string
*/
public function get_created_at_attribute()
{
return date('d F Y H:i:sA', strtotime($this->attributes['created_at']));
}
}
php
// ciacme/application/controllers/Welcome.php
// Create a pagination links with 10 as the limit and
// 100 as the total number of items from the result.
$result = $this->user->paginate(10, 100);
$data = array('links' => $result[1]);
$offset = $result[0];
// The offset can now be used for filter results
// from the specified table (e.g., "users").
$items = $this->user->get(10, $offset);
php
// ciacme/application/controllers/Welcome.php
/** @var array<string, mixed> */
$input = $this->input->post(null, true);
// Create the user with the given input
$this->user->create($input);
// Delete the user based on its ID.
$this->user->delete($id);
// Update the user details with its input
$this->user->update($id, $input);
php
// ciacme/application/controllers/Welcome.php
/** @var array<string, mixed> */
$input = $this->input->post(null, true);
// Find the user based on the given ID
$item = $this->user->find($id);
// Return a filtered list of users based on
// the specified limit and its given offset
$items = $this->user->get($limit, $offset);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.