1. Go to this page and download the library: Download folded/exception library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
folded / exception example snippets
use Folded\Exceptions\FolderNotFoundException;
try {
$exception = new FolderNotFoundException("folder foo not found");
$exception->setFolder("foo");
throw $exception;
} catch (FolderNotFoundException $exception) {
echo "folder not found is {$exception->getFolder()}";
}
use Folded\Exceptions\MethodNotAllowedException;
try {
$exception = new MethodNotAllowedException("method GET not allowed");
$exception->setMethodNotAllowed("GET");
$exception->setAllowedMethods(["POST", "DELETE"]);
$exception->setUrl("/post/store");
throw $exception;
} catch (MethodNotAllowedException $exception) {
$url = $exception->getUrl();
$allowedMethods = $exception->getAllowedMethods();
echo "method not allowed on URL $url: {$exception->getMethodNotAllowed()}";
foreach ($allowedMethods as $allowedMethod) {
echo "allowed method: $allowedMethod";
}
}
use Folded\Exceptions\NotAFolderException;
try {
$exception = new NotAFolderException("foo is not a folder");
$exception->setFolder("foo");
} catch (NotAFolderException $exception) {
echo "folder {$exception->getFolder()} is not a folder";
}
use Folded\Exceptions\UrlNotFoundException;
try {
$exception = new UrlNotFoundException("url /about-us not found");
$exception->setUrl("/about-us");
throw $exception;
} catch (UrlNotFoundException $exception) {
echo "url {$exception->getUrl()} not found";
}
use Folded\Exceptions\HistoryNotFoundException;
try {
$exception = new HistoryNotFoundException("history 1 not found");
$exception->setIndex(1);
throw $exception;
} catch (HistoryNotFoundException $exception) {
echo "index {$exception->getIndex()} not found in the history";
}
use Folded\Exceptions\RouteNotFoundException;
try {
$exception = new RouteNotFoundException("route /about-us not found");
$exception->setRoute("/about-us");
throw $exception;
} catch (RouteNotFoundException $exception) {
echo "route {$exception->getRoute()} not found";
}
use Folded\Exceptions\SessionKeyNotFoundException;
try {
$exception = new SessionKeyNotFoundException("key foo not found");
$exception->setKey("foo");
throw $exception;
} catch (SessionKeyNotFoundException $exception) {
echo "key {$exception->getKey()} not found";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.