PHP code example of maatify / php-category
1. Go to this page and download the library: Download maatify/php-category 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/ */
maatify / php-category example snippets
use Maatify\Category\Factory\CategoryFactory;
use Maatify\Category\Content\Mutation\Command\CreateCategoryContentCommand;
use Maatify\Category\Lifecycle\Command\CreateCategoryCommand;
// $pdo and $clock are supplied by the host application.
$category = CategoryFactory::create($pdo, $clock);
$categoryId = $category->categories()->create(
new CreateCategoryCommand('clothing'),
);
$category->contents()->create(
new CreateCategoryContentCommand($categoryId, null, 'Clothing', null),
);
$visibleCategory = $category->categories()->getById($categoryId);