PHP Classes

Simple React PHP CRUD: Manipulate records in a page done using ReactPHP

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 87 All time: 9,998 This week: 455Up
Version License PHP version Categories
reactphp-simple-crud 1.0.0Shareware5PHP 5, Databases, Language, Design Pa...
Description 

Author

This package can manipulate records in a page done using ReactPHP.

It provides an example class that acts as an interface to manipulate records of SQL database table that stores records of users.

The class performs database access operations using ReactPHP to execute the database access queries.

Applications need to use callback functions to process the results of the database queries.

Picture of Ahmad Mustapha
Name: Ahmad Mustapha <contact>
Classes: 24 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 226511 in Nigeria Nigeria
Week rank: 178 Up7 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 9x

Example

<?php

use Crud\User;
use
React\EventLoop\Factory;
use
React\MySQL\QueryResult;

require
'vendor/autoload.php';

$loop = Factory::create();

$user = new User($loop);

$user->create('Carliedu', 'clu.123')
    ->
then(function (QueryResult $queryResult) use ($user) {
        echo(
"\nUser created successfully\nUserID: {$queryResult->insertId}.\n");
       
$user->getConnection()->close();
    })
    ->
otherwise(function (Throwable $exception) {
        echo
$exception;
    });

$loop->run();


Details

ReactPHP DB CRUD

ReactPHP simple database crud operation.

Installation

Clone this repo

git clone https://github.com/Ahmard/reactphp-crud.git

Install composer packages

cd reactphp-crud
composer update

DB Config

Edit .env file add update it with DB credentials

DB_USER = "root"
DB_PASS = "password"
DB_HOST = "127.0.0.1"
DB_NAME = "myDatabase"

Install DB Tables

Before using this crud demo, DB tables must be installed first.

php create-tables.php

Running Demo

Create new user

php create.php

Read user info

php read.php

Update user info

php create.php

Delete user

php delete.php

List all users

php list.php

  Files folder image Files (11)  
File Role Description
Files folder imagecrud (1 file)
Accessible without login Plain text file .env.example 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 create-tables.php Example Example script
Accessible without login Plain text file create.php Example Example script
Accessible without login Plain text file delete.php Example Example script
Accessible without login Plain text file list.php Example Example script
Accessible without login Plain text file read.php Example Example script
Accessible without login Plain text file README.md Doc. Documentation
Accessible without login Plain text file update.php Example Example script

  Files folder image Files (11)  /  crud  
File Role Description
  Plain text file User.php Class Class source

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:87
This week:0
All time:9,998
This week:455Up