Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report

nunomaduro/termwind v2.0.1

Its like Tailwind CSS, but for the console.
Package summary
Share
0
issues
0
licenses
Package created
30 Sep 2021
Version published
6 Mar 2024
Maintainers
1
Total deps
0
Direct deps
0
License
MIT
Generating a report...
Hold on while we generate a fresh audit report for this package.

Frequently Asked Questions

What does nunomaduro/termwind do?

Termwind, created by nunomaduro, is a unique tool that helps developers build distinctive PHP command-line applications. It borrows from the Tailwind CSS API, bringing into play the aesthetics and usability known in website design to the console. In essence, Termwind is like having Tailwind CSS but in your PHP console applications - think of it as styling for your console commands.

How do you use nunomaduro/termwind?

Implementing Termwind in your project is easy and straightforward. First, you need to install the package using Composer with the following command:

composer require nunomaduro/termwind

Please note that Termwind requires PHP 8.0 or higher. Once installed, you can use Termwind by rendering HTML strings in your PHP files:

use function Termwind\{render};

// Rendering a simple single line
render('<div class="px-1 bg-green-300">Termwind</div>');

// Rendering multi-line HTML
render(<<<'HTML'
    <div>
        <div class="px-1 bg-green-600">Termwind</div>
        <em class="ml-1">
          Give your CLI apps a unique look
        </em>
    </div>
HTML);

One of the powerful features of Termwind is its compatibility with typical PHP frameworks like Laravel or Symfony:

class UsersCommand extends Command
{
    public function handle()
    {
        render(
            view('users.index', [
                'users' => User::all()
            ])
        );
    }
}

You're also allowed to prompt users with the help of the ask() function:

use function Termwind\{ask};

$answer = ask(<<<HTML
    <span class="mt-1 ml-2 mr-1 bg-green px-1 text-black">
        What is your name?
    </span>
HTML);

Where are the nunomaduro/termwind docs?

For more usage examples, functions, and supported HTML elements, please visit the official repository of nunomaduro/termwind on GitHub. All the classes supported follow the same logic that is available on the Tailwind CSS documentation. Furthermore, Termwind also supports Responsive Design just like Tailwind CSS. You can find all of this information and more in the comprehensive guide that has been made available in the repository's README file, accessible via the following URL: https://github.com/nunomaduro/termwind.