PHP code example of jobmetric / typeify
1. Go to this page and download the library: Download jobmetric/typeify 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/ */
jobmetric / typeify example snippets
namespace App\Type;
use JobMetric\Typeify\BaseType;
class PostType extends BaseType
{
protected function typeName(): string
{
return 'post-type';
}
}
$postType = new PostType();
$postType->define('blog')
->label('Blog Post')
->description('Posts for the blog section')
->hierarchical()
->import()
->export();
$postType->define('news')
->label('News')
->description('News articles');
$postType->type('blog');
$label = $postType->getLabel();
$description = $postType->getDescription();
$allParams = $postType->get();
$postType->ensureTypeExists('blog');
$availableTypes = $postType->getTypes();