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

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