1. Go to this page and download the library: Download thyme/framework 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/ */
thyme / framework example snippets
use Roots\Acorn\Application;
use Thyme\Framework\Providers\ThymeServiceProvider;
if (! class_exists(\Roots\Acorn\Application::class)) {
wp_die(
__('You need to install Acorn to use this site.', 'domain'),
'',
[
'link_url' => 'https://roots.io/acorn/docs/installation/',
'link_text' => __('Acorn Docs: Installation', 'domain'),
]
);
}
add_action('after_setup_theme', function () {
Application::configure()
->withProviders([
App\Providers\ThemeServiceProvider::class,
ThymeServiceProvider::class
])
->boot();
}, 0);
use Thyme\Framework\PostType\PostType;
use Thyme\Framework\PostType\HasClassicEditor;
use Thyme\Framework\Icons\DashIcons;
class Event extends PostType {
use HasClassicEditor;
public function slug(): string { return 'event'; }
public function singular(): string { return 'Event'; }
public function plural(): string { return 'Events'; }
public function icon(): string { return DashIcons::Calendar->value; }
}
use Extended\ACF\Fields\Text;
use Extended\ACF\Fields\WYSIWYGEditor;
use Thyme\Framework\Icons\DashIcons;
use Thyme\Framework\Options\OptionsPage;
class Cookie extends OptionsPage {
public function slug(): string { return 'cookie'; }
public function pageTitle(): string { return 'Cookie'; }
public function icon(): string { return DashIcons::StarFilled->value; }
public function position(): ?int { return 21; }
public function fields(): array {
return [
WYSIWYGEditor::make('Text', 'cookie_text')
->helperText('Add the cookie disclaimer text.')
->
namespace App\Blocks;
use Extended\ACF\Fields\Text;
use Thyme\Framework\Blocks\Block;
use Thyme\Framework\Icons\DashIcons;
class Hero extends Block
{
protected ?string $title = 'Hero';
protected string $name = 'hero';
protected ?string $description = 'A hero banner with a heading.';
protected ?string $category = 'design';
protected DashIcons $icon = DashIcons::CoverImage;
public function fields(): array
{
return [
Text::make('Heading', 'heading')->
namespace App\Components\Button;
use Thyme\Framework\Components\Component;
class Button extends Component
{
}
use App\Components\Button\Button;
Button::render(['label' => 'Click Me']);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.