PHP Classes

Learn From a PHP REST API Example How to Use the MVC Design Pattern to Implement an API and a Web Application Using the Package Simple REST API: Example of REST API using the MVC design pattern

Recommend this page to a friend!
  Info   View files Example   View files View files (17)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-27 (2 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 65 This week: 65All time: 10,381 This week: 1Up
Version License PHP version Categories
simple-rest-api 1.0.0The PHP License5PHP 5, Web services, Design Patterns
Description 

Author

This package provides an example of REST API using the MVC design pattern.

It provides an API using model, view, and controller classes.

The API classes can also implement a web interface for an application that manages the same information as the API.

Picture of Adeleye Ayodeji
  Performance   Level  
Name: Adeleye Ayodeji <contact>
Classes: 24 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 14x

Example

<?php
   
include "../include/autoload.php";
   
//Creating an instance of a class
   
$viewUsers = new UserView();
    echo
$viewUsers->viewUsers();

?>


Details

Learn API Development from Scratch using JavaScript and Core PHP

PREVIEW OF THE SIMPLE PROJECT TO BE DEVELOPED

https://adeleyeayodeji.com/simpleapi/

What is REST API?

To define "REST API", we have to know what is "REST" and what is "API" first. I'll do my best to explain it in simple terms because REST has a lot of concepts inside of it that could mean a lot of things.

REST stands for "REpresentational State Transfer". It is a concept or architecture for managing information over the internet. REST concepts are referred to as resources. A representation of a resource must be stateless. It is usually represented by JSON.

What is API?

API stands for "Application Programming Interface". It is a set of rules that allows one piece of software application to talk to another. Those "rules" can include create, read, update and delete operations.

REST API enable your application to communicate with one or several applications using REST concepts which display data with minimum formatting using separators and delimiters (like JSON).

REST API Sample:

GitHub REST API : https://api.github.com/users/adeleyeayodeji/repos

Blog REST API : https://script.adeleyeayodeji.com/api/?token=c5c19e98afe0827d801f158abcde8d63


  Files folder image Files  
File Role Description
Files folder imageapi (4 files)
Files folder imageinclude (2 files, 1 directory)
Files folder imagejs (2 files)
Files folder imageloader (1 file)
Accessible without login Plain text file edit.php Example Example script
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  api  
File Role Description
  Accessible without login Plain text file deleteuser-api.php Example Example script
  Accessible without login Plain text file edituser-api.php Example Example script
  Accessible without login Plain text file userreg-api.php Example Example script
  Accessible without login Plain text file users-api.php Example Example script

  Files folder image Files  /  include  
File Role Description
Files folder imageClass (4 files)
  Accessible without login Plain text file autoload.php Aux. Configuration script
  Accessible without login Plain text file restapi.sql Data Auxiliary data

  Files folder image Files  /  include  /  Class  
File Role Description
  Plain text file Db.php Class Class source
  Plain text file UserController.php Class Class source
  Plain text file UserModel.php Class Class source
  Plain text file UserView.php Class Class source

  Files folder image Files  /  js  
File Role Description
  Accessible without login Plain text file edit_user.js Data Auxiliary data
  Accessible without login Plain text file userload.js Data Auxiliary data

  Files folder image Files  /  loader  
File Role Description
  Accessible without login Image file loader.gif Icon Icon image

 Version Control Unique User Downloads Download Rankings  
 100%
Total:65
This week:65
All time:10,381
This week:1Up