Skip to content

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. πŸ’»

License

Notifications You must be signed in to change notification settings

tomo3076/PHP-CRUD-API-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PHP CRUD API Generator πŸš€

PHP CRUD API Generator License GitHub stars

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

  • 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. 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:

    git clone https://github.com/tomo3076/PHP-CRUD-API-Generator.git
  2. Navigate to the Directory:

    cd PHP-CRUD-API-Generator
  3. Install Dependencies:

    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.
    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:

    curl -X POST -H "Content-Type: application/json" -d '{"name": "John Doe"}' http://yourapi.com/api/users
  • Read Records:

    curl -X GET http://yourapi.com/api/users
  • Update a Record:

    curl -X PUT -H "Content-Type: application/json" -d '{"name": "Jane Doe"}' http://yourapi.com/api/users/1
  • Delete a Record:

    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

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 file for details.

Support

If you have any questions or need support, please check the Releases section 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!

About

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. πŸ’»

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages