Download the PHP package faqzul/codeigniter-crud-model without Composer

On this page you can find all versions of the php package faqzul/codeigniter-crud-model. 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 codeigniter-crud-model

CodeIgniter-CRUD-Model

Create one model for all CodeIgniter controllers, or You can extends this class in Your model class.

Getting Started

Composer

Prerequisites

Configuration

Setting CRUD Preferences

There are 4 different preferences available to suit Your needs. You can set it up manually as described here, or automatically via the preferences stored in Your configuration file, described below:

Preferences are set by passing an array of preference values to the crud initialize method. Here is an example of how You might set some preferences:

:information_source: Note
Most of the preferences have default values that will be used if You do not set them.

Setting CRUD Preferences in a Config File

If You prefer not to set preferences using the above method, You can instead put them into a config file. Simply create a new file called the crud.php, add the $config array in that file. Then save the file at config/crud.php and it will be used automatically. You will NOT need to use the $this->crud->initialize() method if You save Your preferences in a config file.

CRUD Preferences

Here is a list of all the options that can be set when using the crud class.

Preferences Default Value Options Description
dbgroup default None Lets You choose which connection group to make active
delete_record TRUE TRUE or FALSE
(boolean).
TRUE: Your data will be deleted permanently.
FALSE: Your data able to be recovered (un-deleted).
insert_id_key NULL None If using the PDO driver with PostgreSQL, or using the Interbase driver, this preference which specifies the appropriate sequence to check for the insert id.
log_query FALSE TRUE or FALSE
(boolean).
Save the last query that was run.
track_trans FALSE TRUE or FALSE
(boolean).
To know the data (when and who) created or updated.

Usage

createData

:information_source: Note
To use $this->crud->insert_id() or $this->crud->insert_ids() if using the PDO driver with PostgreSQL, or using the Interbase driver, requires preference insert_id_key which specifies the appropriate sequence to check for the insert id.

readData

:information_source: Note
Now, you can use queries JOIN, LIKE, WHERE more specific. See ChangeLog
If preference delete_record FALSE, automatically add WHERE TABLENAME_delete_date IS NULL in Your query.

updateData

deleteData

extends

:information_source: Note
For the sake of simplicity in this example we’re using $_POST directly. This is generally bad practice, and a more common approach would be to use the Input Library $this->input->post('title').

Class Reference

createData($table, $data [, $callback = FALSE ])

  • Parameters:
  • $table (string) - Table name.
  • $data (array) - An associative array of field/value pairs.
  • Returns:
  • $callback = FALSE TRUE on success, FALSE on failure.
  • $callback = TRUE
  • code (int) - SQL error code.
  • insert_id (int) - The insert ID number when performing database inserts.
  • insert_ids (array) - Insert ID from insert_batch.
  • message (string) - SQL error message.
  • Return Type: mixed. createDataQuery($table, $data)
  • Parameters:
  • $table (string) - Table name.
  • $data (array) - An associative array of field/value pairs.
  • Returns: Compiles an INSERT statement and returns it as a string.
  • Return Type: string. readData($select, $from [, $where = NULL [, $joinTable = NULL [, $groupBy = NULL [, $orderBy = NULL [, $limit = NULL ] ] ] ] ])
  • Parameters:
  • $select (string) - The SELECT portion of a query.
  • $from (mixed) - Table name(s); array or string.
  • $where (mixed) - The WHERE clause; array or string.
  • $joinTable (array) - An associative array of table/condition pairs.
  • $groupBy (mixed) - Field(s) to group by; array or string.
  • $orderBy (string) - Field to order by. The order requested - ASC, DESC or random.
  • $limit (array) - Adds LIMIT and OFFSET clauses to a query. array(10, 20).
    1. Key 0 (int) - Number of rows to limit the result to.
    2. Key 1 (int) - Number of rows to skip.
  • Returns: There are several ways to generate query results:
  • Result Arrays.
  • Result Rows.
  • Custom Result Objects.
  • Result Helper Methods.
  • Return Type: CI_DB_result. readDataQuery($select, $from [, $where = NULL [, $joinTable = NULL [, $groupBy = NULL [, $orderBy = NULL [, $limit = NULL ] ] ] ] ])
  • Parameters:
  • $select (string) - The SELECT portion of a query.
  • $from (mixed) - Table name(s); array or string.
  • $where (mixed) - The WHERE clause; array or string.
  • $joinTable (array) - An associative array of table/condition pairs.
  • $groupBy (mixed) - Field(s) to group by; array or string.
  • $orderBy (string) - Field to order by. The order requested - ASC, DESC or random.
  • $limit (array) - Adds LIMIT and OFFSET clauses to a query. array(10, 20).
    1. Key 0 (int) - Number of rows to limit the result to.
    2. Key 1 (int) - Number of rows to skip.
  • Returns: Compiles a SELECT statement and returns it as a string.
  • Return Type: string. updateData($table, $data, $where [, $callback = FALSE ])
  • Parameters:
  • $table (string) - Table name.
  • $data (array) - An associative array of field/value pairs.
  • $where (mixed) - The WHERE clause; array or string.
  • Returns:
  • $callback = FALSE TRUE on success, FALSE on failure.
  • $callback = TRUE error() method.
  • Return Type: mixed. updateDataQuery($table, $data, $where)
  • Parameters:
  • $table (string) - Table name.
  • $data (array) - An associative array of field/value pairs.
  • $where (mixed) - The WHERE clause; array or string.
  • Returns: Compiles an UPDATE statement and returns it as a string.
  • Return Type: string. deleteData($table, $where [, $callback = FALSE ])
  • Parameters:
  • $table (string) - Table name.
  • $where (mixed) - The WHERE clause; array or string.
  • Returns:
  • $callback = FALSE TRUE on success, FALSE on failure.
  • $callback = TRUE error() method.
  • Return Type: mixed. deleteDataQuery($table, $where)
  • Parameters:
  • $table (string) - Table name.
  • $where (mixed) - The WHERE clause; array or string.
  • Returns: Compiles a DELETE statement and returns it as a string.
  • Return Type: string. error()
  • Returns:
  • code (int) - SQL error code.
  • message (string) - SQL error message.
  • Return Type: array. error_code()
  • Returns: SQL error code.
  • Return Type: int. error_message()
  • Returns: SQL error message.
  • Return Type: string. insert_id()
  • Returns: The insert ID number when performing database inserts.
  • Return Type: int. insert_ids()
  • Returns: The insert ID number when performing database inserts.
  • Return Type: array.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details.


All versions of codeigniter-crud-model with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.8
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 faqzul/codeigniter-crud-model contains the following files

Loading the files please wait ....