1. Go to this page and download the library: Download phossa2/shared 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/ */
phossa2 / shared example snippets
namespace Phossa2\Cache\Exception;
use Phossa2\Shared\Exception\ExceptionInterface;
class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
{
}
use Phossa2\Cache\Message\CaseMessage;
...
// throw exception
throw new \RuntimeException(
CacheMessage::get(CacheMessage::CACHE_DRIVER_FAIL, get_class($driver)),
CacheMessage::CACHE_DRIVER_FAIL
);
namespace Phossa2\Cache;
use Phossa2\Cache\Message\CaseMessage;
use Phossa2\Shared\Message\Loader\LanguageLoader;
// set language to 'zh_CN'
$langLoader = new LanguageLoader('zh_CN');
// will load `CacheMessage.zh_CN.php` in the same dir as `CacheMessage.php`
CacheMessage::setLoader($langLoader);
// print message in chinese
echo CacheMessage::get(
CacheMessage::CACHE_MESSAGE, get_class($object)
);
namespace Phossa2\Cache;
use Phossa2\Cache\Message\CaseMessage;
use Phossa2\Shared\Message\Formatter\HtmlFormatter;
// format message as HTML
$formatter = new HtmlFormatter();
CacheMessage::setFormatter($formatter);
// print as HTML
echo CacheMessage::get(
CacheMessage::CACHE_MESSAGE, get_class($object)
);
namespace Phossa2\MyPackage;
class MyStaticClass extends \Phossa2\Shared\Base\StaticAbstract
{
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.