PHP Classes

Learn from a PHP MVC Example with a Database Connection Package PHP RESTful API: API application that uses the MVC design pattern

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-10-20 (23 hours ago) RSS 2.0 feedNot enough user ratingsTotal: 3 This week: 3All time: 11,460 This week: 16Up
Version License PHP version Categories
pure-php-restful-api 1.0MIT/X Consortium ...7Databases, Design Patterns, PHP 7, Ap...
Description 

Author

This package provides an AP application that uses the MVC design pattern.

It implements a simple API that uses classes to implement controllers, models, HTTP request routing, an HTTP response handler, MySQL database access using PDO, and load configuration from environment variables.

The core class can run the API application by dispatching HTTP requests to the controller classes configured for the API application.

Picture of Cauê Santana
  Performance   Level  
Name: Cauê Santana <contact>
Classes: 2 packages by
Country: Brazil Brazil
Innovation award
Innovation award
Nominee: 1x

Example

<?php

require_once __DIR__ . '/../vendor/autoloader.php';
require_once
__DIR__ . '/../routes/web.php';

use
RestfulAPI\Utils\Env;
use
RestfulAPI\Core\Core;

Env::load();
Core::run($router);


Details

Pure PHP Restful API ?

> The Pure PHP Restful API is a lightweight and efficient framework designed to facilitate the development of RESTful APIs using PHP. Its primary purpose is to streamline the process of creating web services that can handle various HTTP methods, allowing developers to easily manage data and interact with client applications.

Authors ?

  • For more information see my blog and my contributions to community. - dantsec

Tech Stack ???

  • This project was developed with the following technologies: - PHP (Main Language)

Documents ?

Installation / Run Locally ??

  • Important: First of all, you must have PHP and a server like APACHE installed;
#
# Put the project into the server folder (e.g.: `public_html`, `/var/www/html`)
#

#
# Setup your database and start your server
#
# e.g.:
sudo systemctl start xampp

#
# Copy .env.example and configure it
#
cp config/.env.example .env

#
# Go to: <PROTOCOL>://<HOST>:<PORT>/<PROJECT_PATH>/public
#
# e.g.:
brave http://localhost:8080/php-restful-api/public/

Todo List ?

  • Priority (1) - [ ] "Universalize" `{id}` field in `Core/Core.php` line 32. - [ ] Improve file security on `.htaccess`. - [ ] Make migrations.
  • Priority (2) - [ ] Make it full MVC (implementing _view_ like laravel <3)

Contributing ??

# Create a fork from the original repository and clone it.
git clone https://github.com/dantsec/php-restful-api.git
# Enter into the project folder.
cd php-restful-api/
# Create a new branch with the name feat-[BRANCH_NAME].
git checkout -b feat-[BRANCH_NAME]
# Make your changes and commit them.
git add . && git commit -m "YOUR_COMMIT_MESSAGE"
# Push your branch and open a pull request.
git push origin feat-[BRANCH_NAME]

  Files folder image Files (21)  
File Role Description
Files folder imageapp (4 directories)
Files folder imageconfig (1 file)
Files folder imagedocs (1 directory)
Files folder imagepublic (2 files)
Files folder imageroutes (1 file)
Files folder imagevendor (1 file)
Accessible without login Plain text file .editorconfig Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (21)  /  app  
File Role Description
Files folder imageControllers (1 file)
Files folder imageCore (1 file)
Files folder imageModels (1 file)
Files folder imageUtils (3 files)

  Files folder image Files (21)  /  app  /  Controllers  
File Role Description
  Plain text file UserController.php Class Class source

  Files folder image Files (21)  /  app  /  Core  
File Role Description
  Plain text file Core.php Class Class source

  Files folder image Files (21)  /  app  /  Models  
File Role Description
  Plain text file UserModel.php Class Class source

  Files folder image Files (21)  /  app  /  Utils  
File Role Description
  Plain text file Connection.php Class Class source
  Plain text file Env.php Class Class source
  Plain text file HttpResponseHandler.php Class Class source

  Files folder image Files (21)  /  config  
File Role Description
  Accessible without login Plain text file .env.example Data Auxiliary data

  Files folder image Files (21)  /  docs  
File Role Description
Files folder imagephp-api-collection (6 files, 1 directory)

  Files folder image Files (21)  /  docs  /  php-api-collection  
File Role Description
Files folder imageenvironments (1 file)
  Accessible without login Plain text file Add User.bru Data Auxiliary data
  Accessible without login Plain text file bruno.json Data Auxiliary data
  Accessible without login Plain text file Delete User.bru Data Auxiliary data
  Accessible without login Plain text file Get Single User.bru Data Auxiliary data
  Accessible without login Plain text file Get Users.bru Data Auxiliary data
  Accessible without login Plain text file Update User.bru Data Auxiliary data

  Files folder image Files (21)  /  docs  /  php-api-collection  /  environments  
File Role Description
  Accessible without login Plain text file env.bru Data Auxiliary data

  Files folder image Files (21)  /  public  
File Role Description
  Accessible without login Plain text file .htaccess Data Auxiliary data
  Accessible without login Plain text file index.php Example Example script

  Files folder image Files (21)  /  routes  
File Role Description
  Accessible without login Plain text file web.php Conf. Configuration script

  Files folder image Files (21)  /  vendor  
File Role Description
  Accessible without login Plain text file autoloader.php Aux. Configuration script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:3
This week:3
All time:11,460
This week:16Up