Browsed by
Snippet Tag: composer

composer autoload

composer autoload

<?php require "vendor/autoload.php"; use \jsmcm\Logger\Log; use \manfred\Reader\Read; $oLog = new Log(); $oRead = new Read();

composer example

composer example

<?php include __DIR__."/vendor/autoload.php"; use Monolog\Logger; use Monolog\Handler\StreamHandler; // create a log channel $log = new Logger(‘usdToZar’); $log->pushHandler(new StreamHandler(‘/var/www/html/test/log’, Logger::DEBUG)); // add records to the log $log->info("About to get exchange rate"); $client = new \GuzzleHttp\Client(); try { $res = $client->request(‘GET’, ‘http://api.softsmart.co.za/exchange/’); } catch (Exception $e) { print "An error occurred and has been logged. Please check the log file for info!"; $log->error("http request error resulted in an error", array("error"=>$e)); exit(); } $log->info("http result: ".$res->getStatusCode()); if ($res->getStatusCode() != 200) { $log->error("http request…

Read More Read More