1. Go to this page and download the library: Download fsmdev/constants-collection 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/ */
fsmdev / constants-collection example snippets
use Fsmdev\ConstantsCollection\ConstantsCollection;
class PostStatus extends ConstantsCollection
{
const EDITED = 1;
const PUBLISHED = 2;
const DELETED = 3;
}
$post = new Post();
$post->status = PostStatus::PUBLISHED;
class Post
{
public function isPublished()
{
return $this->status == PostStatus::PUBLISHED;
}
}