PHP Classes

File: src/index.php

Recommend this page to a friend!
  Classes of Punto Waskito   PHP CRUD API   src/index.php   Download  
File: src/index.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP CRUD API
Provide API to manipulate database table records
Author: By
Last change:
Date: 3 years ago
Size: 756 bytes
 

Contents

Class file image Download
<?php

namespace Tqdev\PhpCrudApi;

use
Tqdev\PhpCrudApi\Api;
use
Tqdev\PhpCrudApi\Config;
use
Tqdev\PhpCrudApi\RequestFactory;
use
Tqdev\PhpCrudApi\ResponseUtils;

require
'../vendor/autoload.php';

$config = new Config([
   
// 'driver' => 'mysql',
    // 'address' => 'localhost',
    // 'port' => '3306',
   
'username' => 'php-crud-api',
   
'password' => 'php-crud-api',
   
'database' => 'php-crud-api',
   
// 'debug' => false
]);
$request = RequestFactory::fromGlobals();
$api = new Api($config);
$response = $api->handle($request);
ResponseUtils::output($response);

//file_put_contents('request.log',RequestUtils::toString($request)."===\n",FILE_APPEND);
//file_put_contents('request.log',ResponseUtils::toString($response)."===\n",FILE_APPEND);