Download the PHP package mg3lo/mysql-crud-api without Composer

On this page you can find all versions of the php package mg3lo/mysql-crud-api. 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 mysql-crud-api

What is MySql CRUD API

MySql Crud Api is a Plug and Play PHP Library created to Auto-magically build CRUD capabilities for your MySql Database using RESTful API calls. This library is dependent to Mysql Crud Library which is another Plug and Play PHP Library similar to Query Builder and Eloquent ORM but on Steroids.

Easy Peasy Summary

C-reate  POST http://your-website.com/{route}/{database-table-name}
R-ead    GET http://your-website.com/{route}/{database-table-name}/{id}/{related-table-name}/{id}?{parameter}={value}
U-pdate  PUT|PATCH http://your-website.com/{route}/{database-table-name}/{id}
D-elete  DELETE http://your-website.com/{route}/{database-table-name}/{id}
Description HTTP Verb URL
All Records GET http://your-website.com/crud/products
Record ID GET http://your-website.com/crud/products/1
Filtered Records GET http://your-website.com/crud/products?status=active
Search Records GET http://your-website.com/crud/products?search=iphone
Pagination GET http://your-website.com/crud/products?limit=100&offset=100
Sort and Order GET http://your-website.com/crud/products?sort=price&order=asc
Child Records GET http://your-website.com/crud/categories/1/products
Related Records GET http://your-website.com/crud/categories?with=products
Add Record/s POST http://your-website.com/crud/products
Add Related Records POST http://your-website.com/crud/categories?with=product
Update a Record PUT or PATCH http://your-website.com/crud/products/1
Update Records PUT or PATCH http://your-website.com/crud/products
Delete a Record DELETE http://your-website.com/crud/products/1
Delete Records DELETE http://your-website.com/crud/products

Table of Contents

Installation

To install this project, you have two options:

Install via Composer

To install using Composer, run the following command:

composer require mg3lo/mysql-crud-api

Manual Installation

To install manually, follow these steps:

  1. Download the library from developer tools.
  2. Unzip the downloaded file to your extensions directory.

System requirements

Note: Tested on the following versions but might work on older versions as well.

PHP Users

  1. Download the sample installation or Install via composer

  2. Load the library on php file

  3. Let the library handle all requests

  4. Enjoy!

Codeigniter Users

  1. Unzip the sample library for Codeigniter 3 or Codeigniter 4 or Install via composer

  2. Create routes to catch all requests going to your crud url e.g. http://your-website/crud/{anything-goes}

  3. Load the library on your controller

  4. Let the library handle all requests

  5. Enjoy!

Laravel Users

  1. Install via composer or unzip the library according to folder structure

  2. Create routes to catch all requests going to your crud url e.g. http://your-website/crud/{anything-goes}

  3. Load the library on your route or controller

  4. Let the library handle all requests

  5. Enjoy!

Other PHP Frameworks

  1. Download the sample installation or Install via composer

  2. Load the library

  3. Let the library handle all requests

  4. Enjoy!

Retrieving Records

Retrieving records generally follow this URL format.

GET http://your-website.com/{route}/{database-table-name}/{id}/{related-table-name}/{id}?{parameter}={value}

All Records

Retrieves all records from products table

http://your-website.com/crud/products

Single Record

Retrieves the record with the id of 1 from products table

http://your-website.com/crud/products/1

Filtered Records

Retrieves products that are currently active

http://your-website.com/crud/products?status=active

Child Records

Retrieves products that belong to category 1

http://your-website.com/crud/categories/1/products

Related Records

Retrieves categories and their respective products

http://your-website.com/crud/categories?with=products

Searching Records

We can search records and search specific columns

http://your-website.com/crud/products?search=iphone
http://your-website.com/crud/products?search=iphone&search-fields=name,description
http://your-website.com/crud/products?search=iphone&search-fields[0]=name&search-fields[1]=description

Parameters

Using query parameters can further make our filters better.

API Key

Use API keys to protect your data.

http://your-website.com/crud/products?api-key=YourApiKey

Limit and Offset

Use limit and offset to limit the records retrieved and create paginations

Limit

Retrieves the first 100 records

http://your-website.com/crud/products?limit=100

Offset

Retrieves records 101 to 200

http://your-website.com/crud/products?limit=100&offset=100

Sort and Order

Sort and order records according to your liking

Sort

Sort records from a databse column name

http://your-website.com/crud/products?sort=price

Order

Order records ascending or descending

http://your-website.com/crud/products?sort=price&order=asc

Envelop

By default records are returned with an envelope you can turn it off by passing true or false

http://your-website.com/crud/products?envelop=false

Case

By default records are returned using underscore case. You can change them by passing any of the ff: (underscore, pascal, camel, dash)

http://your-website.com/crud/products?case=camel

Format

By default the library returns JSON as response, you can change it to (csv, xml, json or jsonp)

http://your-website.com/crud/products?format=xml

Creating Records

Creating records generally follow this URL format.

POST http://your-website.com/{route}/{database-table-name}

Create Single Record

We can add records by posting data to the url

http://your-website.com/crud/products

POST Data

[
  'name' => 'iPhone',
  'description' => 'Cellphone',
  'price' => '999',
]

Create Multiple Records

We can also add multiple records from the same url

http://your-website.com/crud/products

POST Data

[
  [
    'name' => 'iPhone',
    'description' => 'Cellphone',
    'price' => '999',
  ],
  [
    'name' => 'iPhone',
    'description' => 'Cellphone',
    'price' => '999',
  ]
]

Updating Records

Updating records generally follow this URL format.

PUT|PATCH http://your-website.com/{route}/{database-table-name}/{id}

Update Single Record

We can update a record from the ID url

PUT|PATCH http://your-website.com/crud/products/1

PUT or PATCH Data

[
  'name' => 'iPhone',
  'description' => 'New Description',
  'price' => '799',
]

Update Multiple Records

We can update multiple records

PUT|PATCH http://your-website.com/crud/products

PUT or PATCH Data

[
  [
    'id' => 1,
    'name' => 'iPhone',
    'description' => 'Cellphone',
    'price' => '999',
  ],
  [
    'id' => 2,
    'name' => 'iPhone',
    'description' => 'Cellphone',
    'price' => '999',
  ]
]

Note: We can also use POST for Updating records just pass a method override on your post _method

POST http://your-website.com/crud/products/1

POST Data

[
  'name' => 'iPhone',
  'description' => 'New Description',
  'price' => '799',
  _method => "put" // methhod ovverride
]

Deleting Records

Updating records generally follow this URL format.

DELETE http://your-website.com/{route}/{database-table-name}/{id}

Delete Multiple Records

To delete multiple files we pass their ids

DELETE http://your-website.com/{route}/{database-table-name}/{id}

DELETE Data

[
    ids = [1,2,3]
]

Configuration File

Your config file is located at Mg3lo\src\config\MySqlCrudApi.php make sure all the configurations are correct.


All versions of mysql-crud-api with dependencies

PHP Build Version
Package Version
Requires mg3lo/mysql-crud 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 mg3lo/mysql-crud-api contains the following files

Loading the files please wait ....