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.
- Download the latest version of the package from the releases page.
- Extract the contents of the archive.
- Copy the files from this package to the correspoding folders in your application folder.
- Install PhpCrudApi via Composer in root directory of your project:
composer require mevdschee/php-crud-api
- Update the
crud_api.php
file with your database credentials and other configuration options. - Update your routes:
$route['api/(.*)'] = 'api/index';
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
.
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.
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.
This project is based on PHP-CRUD-API by Marco van de Voort.
Contributions are welcome! If you encounter any issues or have ideas for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.