Skip to content

drkNsubuga/codeigniter-crud-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeIgniter CRUD API

License CodeIgniter Version Latest Release GitHub Stars GitHub Forks Open Issues

This Codeigniter package provides a simple integration of the PhpCrudApi library, allowing for automatic API generation based on your database. It provides CodeIgniter-specific functionality and configuration.

Installation

  1. Download the latest version of the package from the releases page.
  2. Extract the contents of the archive.
  3. Copy the files from this package to the correspoding folders in your application folder.
  4. Install PhpCrudApi via Composer in root directory of your project:
composer require mevdschee/php-crud-api
  1. Update the crud_api.php file with your database credentials and other configuration options.
  2. Update your routes:
$route['api/(.*)'] = 'api/index';

Usage

Once installed, the CRUD API can be accessed via the /records endpoint of your CodeIgniter application. For example, if your CodeIgniter application is running on http://localhost, the CRUD API can be accessed at http://localhost/api/records.

Endpoints

The following endpoints are available:

  • /records - The main CRUD API endpoint. Provides Create, Read, Update, and Delete operations for database tables.
  • /cache/clear - Clears the cache for the application, if applicable.
  • /geojson - Provides a GeoJSON data endpoint for serving geospatial data.
  • /openapi - Provides an OpenAPI (formerly Swagger) specification for the API.
  • /status/ping - Provides a simple status check endpoint for testing the availability of the API.
  • /login - Provides a login page for managing user authentication.
  • /logout - Logs the user out and redirects them to the login page.

Configuration

The config/crud_api.php file provides options for configuring the CRUD API. Options include database credentials, cache settings, and OpenAPI information. See the comments in the file for more information.

Documentation

Credits

This project is based on PHP-CRUD-API by Marco van de Voort.

Contributing

Contributions are welcome! If you encounter any issues or have ideas for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.