GMKLAB

Object-Oriented PHP RESTful API Generator

Save hours of development by instantly generating a complete and structured PHP Object-Oriented API — including routes, controllers, models and database connection.

Your API name


📁 API tree preview

🔮 Swagger

Download YAML Download JSON

⚠️ Disclaimer : Please note that we are not responsible for how you use the generated API or for any potential security issues you may encounter when deploying or configuring your solution. It is your responsibility to secure and maintain your API properly.

📖 Documentation

This generator automatically creates a fully functional Object-Oriented PHP RESTful API that follows modern best practices : class autoloading, RESTful routing, input validation, CRUD management, and structured JSON responses. The generated API connects securely to a database via PDO, providing a robust and ready-to-use backend solution. Feel free to adapt the provided solution to your needs.


🛠️ Generated Files & Directories :

  • index.php
    Single entry point routing requests to appropriate controllers.
  • autoload.php
    Automatically loads your classes from controllers and models.
  • .htaccess
    Enables clean URLs and forces HTTPS for secure API communication.
  • config/database.php
    Database connection setup using PDO (adjust credentials accordingly).
  • controllers/
    Contains the controllers handling API logic for each endpoint.
  • models/
    Contains data models performing CRUD operations on the database.

🚀 Using the Generated API :

Endpoints use standard CRUD operations :

  • GET : Retrieve resources
    • GET /api/users retrieves all users.
    • GET /api/users/{id} retrieves a specific user.
  • POST : Create a new resource
    • POST /api/users with JSON body creates a new user.
  • PUT : Update an existing resource
    • PUT /api/users/{id} updates the user with the specified ID.
  • DELETE : Delete an existing resource
    • DELETE /api/users/{id} deletes the specified user.

🔒 Security and Best Practices :

  • Ensure HTTPS is always enabled for your API endpoints.
  • Update database credentials in config/database.php.
  • Handle sensitive data securely and validate inputs strictly.