1. Go to this page and download the library: Download huangdijia/constants 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/ */
huangdijia / constants example snippets
class ErrorCode
{
const NOT_FOUND = 404;
const SERVER_ERROR = 500;
public static $errors = [
self::NOT_FOUND => 'Not Found',
self::SERVER_ERROR => 'Server Error',
];
public static function getMessage($code)
{
return self::$errors[$code] ?? '';
}
}