Termwind allows you to build unique and beautiful PHP command-line applications, using the Tailwind CSS API. In short, it's like Tailwind CSS, but for the PHP command-line applications.
Requires PHP 8.0+
Require Termwind using Composer:
composer require nunomaduro/termwind --dev
div([
div([
a('pestphp.com', 'ml-2 mb-1 text-color-magenta font-bold')->href('https://pestphp.com'),
span('PASS', 'mt-1 ml-2 px-1 text-color-gray font-bold bg-green'),
span('Tests\Feature\ExampleTest.php', ' mx-1 text-color-white'),
]),
div([
span('✓', 'ml-2 text-color-green'),
span('basic test', 'mx-1 text-color-gray'),
], 'mt-1'),
], 'my-1')->render();
The span()
function may be used to render an inline container used to mark up a part of a text.
use function Termwind\{div, a, span};
span('Hello World', 'p-2 text-color-white bg-blue')->render();
div([
span('Hello', 'p-2 text-color-white bg-blue'),
span('World', 'p-2 text-color-white bg-blue'),
])->render();
The a()
function may be used to render an inline anchor container used to mark up a clickable hyperlink.
use function Termwind\{render, a};
a('https://github.com/nunomaduro/termwind', 'p-2 text-color-white bg-blue')->render();
div([
a('https://github.com/nunomaduro/termwind', 'p-2 text-color-white bg-blue'),
a('Termwind', 'p-2 text-color-white bg-blue')->href('https://github.com/nunomaduro/termwind'),
])->render();
The style()
function may be used to add own custom syles.
use function Termwind\{style, span};
style('btn')->apply('p-4 bg-blue text-color-white');
span('Click me', 'btn')->render();
Termwind is an open-sourced software licensed under the MIT license.