PHP Classes

PHP MongoDB CRUD Example of API: API that provides CRUD operations with MongoDB

Recommend this page to a friend!
  Info   View files Example   View files View files (31)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Last Updated Ratings Unique User Downloads Download Rankings
2023-10-22 (2 months ago) RSS 2.0 feedNot enough user ratingsTotal: 71 All time: 10,189 This week: 118Up
Version License PHP version Categories
php-mongodb-crud-api 1.0.0The PHP License5Databases, Web services, PHP 7, Appli...
Description 

Author

This package implements an API that provides CRUD operations with MongoDB.

It provides code for an example API that uses the MongoDB database to store and retrieve data records.

Currently, it implements API functions to perform operations to create, retrieve, update, and delete records of users and products.

Innovation Award
PHP Programming Innovation award nominee
October 2023
Number 6
MongoDB is a popular NoSQL database that stores information records in a document database.

This package provides an example application that shows how to implement a Web services API that can perform CRUD (Create, Retrieve, Update, and Delete) operations on records of information stored in a MongoDB database.

Manuel Lemos
Picture of Okanlawon Anuoluwapo
  Performance   Level  
Name: Okanlawon Anuoluwapo <contact>
Classes: 4 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 3x

Example

<?php
require __DIR__ . '/config.php';

$user = new User();

if (
$_SERVER['REQUEST_METHOD'] === "GET" ) :
    try {
       
$result = $user->findAllUser();
       
//
       
HttpResponse::OK($result);
    } catch (\
Throwable $th) {
       
HttpResponse::badRequest($th->getMessage());
    }
endif;


Details

PHP and MongoDB CRUD API sample


  Files folder image Files  
File Role Description
Files folder imageapi (8 files, 1 directory)
Files folder imageapp (4 files, 3 directories)
Accessible without login Plain text file index.php Aux. Auxiliary script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  api  
File Role Description
Files folder imageclasses (4 files)
  Accessible without login Plain text file .env Data Auxiliary data
  Accessible without login Plain text file composer.json Data Auxiliary data
  Accessible without login Plain text file composer.lock Data Auxiliary data
  Accessible without login Plain text file config.php Example Example script
  Accessible without login Plain text file index.php Example Example script
  Accessible without login Plain text file product.php Example Example script
  Accessible without login Plain text file README.md Doc. Documentation
  Accessible without login Plain text file user.php Example Example script

  Files folder image Files  /  api  /  classes  
File Role Description
  Plain text file ErrorHandler.php Class Class source
  Plain text file HttpResponse.php Class Class source
  Plain text file Product.php Class Class source
  Plain text file User.php Class Class source

  Files folder image Files  /  app  
File Role Description
Files folder imagecss (1 file)
Files folder imageimages (9 files, 1 directory)
Files folder imagejs (1 file)
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Plain text file manifest.json Data Auxiliary data
  Accessible without login HTML file new.html Doc. Documentation
  Accessible without login Plain text file serviceWorker.js Data Auxiliary data

  Files folder image Files  /  app  /  css  
File Role Description
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  app  /  images  
File Role Description
Files folder imageicons (2 files)
  Accessible without login Image file coffee1.jpg Data Auxiliary data
  Accessible without login Image file coffee2.jpg Data Auxiliary data
  Accessible without login Image file coffee3.jpg Data Auxiliary data
  Accessible without login Image file coffee4.jpg Data Auxiliary data
  Accessible without login Image file coffee5.jpg Data Auxiliary data
  Accessible without login Image file coffee6.jpg Data Auxiliary data
  Accessible without login Image file coffee7.jpg Data Auxiliary data
  Accessible without login Image file coffee8.jpg Data Auxiliary data
  Accessible without login Image file coffee9.jpg Data Auxiliary data

  Files folder image Files  /  app  /  images  /  icons  
File Role Description
  Accessible without login Image file icon-192x192.png Icon Icon image
  Accessible without login Image file icon-512x512.png Data Auxiliary data

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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:71
This week:0
All time:10,189
This week:118Up