https://github.com/tomo3076/php-crud-api-generator
PHP CRUD API Generator allows you to quickly turn your MySQL/MariaDB database into a REST-like API with ease. π With features like auto-discovery of tables and robust authentication options, it simplifies backend development while ensuring security. π»
https://github.com/tomo3076/php-crud-api-generator
api-generator maraidb-api maria-database-api mariadb mysql mysql-api php php-api php-api-generator phpapi phpcrudapi
Last synced: 6 months ago
JSON representation
PHP CRUD API Generator allows you to quickly turn your MySQL/MariaDB database into a REST-like API with ease. π With features like auto-discovery of tables and robust authentication options, it simplifies backend development while ensuring security. π»
- Host: GitHub
- URL: https://github.com/tomo3076/php-crud-api-generator
- Owner: tomo3076
- License: mit
- Created: 2025-05-22T09:10:57.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-06-20T01:45:20.000Z (6 months ago)
- Last Synced: 2025-06-20T02:33:15.605Z (6 months ago)
- Topics: api-generator, maraidb-api, maria-database-api, mariadb, mysql, mysql-api, php, php-api, php-api-generator, phpapi, phpcrudapi
- Language: PHP
- Size: 17.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP CRUD API Generator π



Welcome to the **PHP CRUD API Generator** repository! This tool helps you quickly create a fully functional API for your MariaDB or MySQL database using PHP. Whether you are a developer looking to streamline your API development or a beginner eager to learn, this project provides a simple and effective solution.
## Table of Contents
- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [API Endpoints](#api-endpoints)
- [Configuration](#configuration)
- [Contributing](#contributing)
- [License](#license)
- [Support](#support)
## Features
- **Easy Setup**: Quickly generate APIs with minimal configuration.
- **Supports MariaDB and MySQL**: Work with the databases you know.
- **RESTful API**: Follow REST principles for easy integration.
- **Customizable**: Modify generated code to suit your needs.
- **Lightweight**: Designed to be efficient and fast.
## Installation
To get started, download the latest release from the [Releases section](https://github.com/tomo3076/PHP-CRUD-API-Generator/releases). After downloading, extract the files to your server directory.
### Prerequisites
- PHP 7.2 or higher
- MariaDB or MySQL
- Composer (for dependency management)
### Steps
1. **Clone the Repository**:
```bash
git clone https://github.com/tomo3076/PHP-CRUD-API-Generator.git
```
2. **Navigate to the Directory**:
```bash
cd PHP-CRUD-API-Generator
```
3. **Install Dependencies**:
```bash
composer install
```
4. **Configure Your Database**: Open the `config.php` file and set your database credentials.
5. **Run the Application**: Access the API through your web server.
## Usage
Once you have installed the API generator, you can start creating your endpoints. Hereβs how to use the tool effectively:
1. **Define Your Database Structure**: Create tables in your MariaDB or MySQL database.
2. **Generate the API**: Use the command line to generate your API endpoints.
```bash
php generate.php
```
3. **Test Your API**: Use tools like Postman or curl to test the endpoints.
## API Endpoints
The API supports various endpoints for CRUD operations:
- **Create**: POST request to create a new record.
- **Read**: GET request to retrieve records.
- **Update**: PUT request to update an existing record.
- **Delete**: DELETE request to remove a record.
### Example Requests
- **Create a Record**:
```bash
curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe"}' http://yourapi.com/api/users
```
- **Read Records**:
```bash
curl -X GET http://yourapi.com/api/users
```
- **Update a Record**:
```bash
curl -X PUT -H "Content-Type: application/json" -d '{"name": "Jane Doe"}' http://yourapi.com/api/users/1
```
- **Delete a Record**:
```bash
curl -X DELETE http://yourapi.com/api/users/1
```
## Configuration
To configure your API, modify the `config.php` file. You will need to set the following parameters:
- **Database Host**: Your database server address.
- **Database Name**: The name of your database.
- **Database User**: Your database username.
- **Database Password**: Your database password.
### Example Configuration
```php
define('DB_HOST', 'localhost');
define('DB_NAME', 'your_database');
define('DB_USER', 'your_username');
define('DB_PASS', 'your_password');
```
## Contributing
We welcome contributions! If you would like to help improve the PHP CRUD API Generator, please follow these steps:
1. Fork the repository.
2. Create a new branch (`git checkout -b feature/YourFeature`).
3. Make your changes.
4. Commit your changes (`git commit -m 'Add some feature'`).
5. Push to the branch (`git push origin feature/YourFeature`).
6. Open a Pull Request.
## License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Support
If you have any questions or need support, please check the [Releases section](https://github.com/tomo3076/PHP-CRUD-API-Generator/releases) for updates. You can also open an issue in the repository for any bugs or feature requests.
---
Thank you for using the PHP CRUD API Generator! We hope this tool makes your API development process easier and more efficient. Happy coding!