PHP Classes

File: bin/rest-control

Recommend this page to a friend!
  Classes of Kamil   PHP REST Client Framework Control   bin/rest-control   Download  
File: bin/rest-control
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP REST Client Framework Control
Testing and validating REST services
Author: By
Last change:
Date: 6 years ago
Size: 859 bytes
 

Contents

Class file image Download
#!/usr/bin/env php
<?php

$autoloadFiles
= [
   
'loader' => [
       
__DIR__ . '/../vendor/autoload.php',
       
__DIR__ . '/../../../autoload.php',
    ],
   
'helpers' => [
       
__DIR__ . '/../src/helpers.php',
       
__DIR__ . '/../rest-control/rest-control/src/helpers.php',
    ],
];

$loadedFiles = null;

foreach(
$autoloadFiles as $autoloadFileName => $autoloadFileDirs) {
    foreach(
$autoloadFileDirs as $dir) {
        if(
file_exists($dir)) {
           
$loadedFiles[$autoloadFileName] = require_once $dir;
        }
    }
}

if(empty(
$loadedFiles['loader'])) {
    throw new \
Exception('Cannot find autoload.php. Please install dependencies via composer.');
}

try{
   
$console = new \RestControl\Console\Console($loadedFiles['loader']);
    exit(
$console->run());
} catch (\
Exception $e) {
    echo
$e->getMessage() . "\n";
    exit(
1);
}