Điểm qua nunomaduro/termwind: 2.5k sao trên GitHub, viết chủ yếu bằng PHP, thuộc nhóm Frontend. 🍃 In short, it's like Tailwind CSS, but for the PHP command-line applications.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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.
Installation
Requires PHP 8.0+
Require Termwind using Composer:
composer require nunomaduro/termwind
Usage
use function Termwind\{render};
// single line html...
render('<div class="px-1 bg-green-300">Termwind</div>');
// 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);
// Laravel or Symfony console commands...
class UsersCommand extends Command
{
public function handle()
{
render(
view('users.index', [
'users' => User::all()
])
);
}
}
style()
The style() function may be used to add own custom styles and also update colors.
use function Termwind\{style};
style('green-300')->color('#bada55');
style('btn')->apply('p-4 bg-green-300 text-white');
render('<div class="btn">Click me</div>');
ask()
The ask() function may be used to prompt the user with a question.
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);
The return provided from the ask method will be the answer provided from the user.
terminal()
The terminal() function returns an instance of the Terminal class, with the following methods:
->width(): Returns the full width of the terminal.
->height(): Returns the full height of the terminal.
->clear(): It clears the terminal screen.
Classes Supported
All the classes supported use exactly the same logic that is available on tailwindcss.com/docs.
Background Color:bg-{color}-{variant}.
Text Color:text-{color}-{variant}.
Font Weight:font-bold, font-normal.
Font Style:italic.
Text Decoration:underline, line-through.
Text Transform:uppercase, lowercase, capitalize, snakecase.
Text Overflow:truncate.
Text Alignment:text-left, text-center, text-right.
List Style:list-disc, list-decimal, list-square, list-none.
Content:content-repeat-['.'].
Responsive Design
Like TailwindCSS we also support Responsive Design media queries and this are the breakpoints supported:
sm: 64 spaces (640px)
md: 76 spaces (768px)
lg: 102 spaces (1024px)
xl: 128 spaces (1280px)
2xl: 153 spaces (1536px)
render(<<<'HTML'
<div class="bg-blue-500 sm:bg-red-600">
If bg is blue is sm, if red > than sm breakpoint.
</div>
HTML);
All the sizes for the CLI are based on Font Size 15.
HTML Elements Supported
All the elements have the capability to use the class attribute.
<div>
The <div> element can be used as a block type element.
Default Styles: block
render(<<<'HTML'
<div>This is a div element.</div>
HTML);
<p>
The <p> element can be used as a paragraph.
Default Styles: block
render(<<<'HTML'
<p>This is a paragraph.</p>
HTML);
<span>
The <span> element can be used as an inline text container.
render(<<<'HTML'
<p>
This is a CLI app built with <span class="text-green-300">Termwind</span>.
</p>
HTML);
<a>
The <a> element can be used as a hyperlink. It allows to use the href attribute to open the link when clicked.
render(<<<'HTML'
<p>
This is a CLI app built with Termwind. <a href="/">Click here to open</a>
</p>
HTML);
<b> and <strong>
The <b>and <strong> elements can be used to mark the text as bold.
Default Styles: font-bold
render(<<<'HTML'
<p>
This is a CLI app built with <b>Termwind</b>.
</p>
HTML);
<i> and <em>
The <i> and <em> elements can be used to mark the text as italic.
Default Styles: italic
render(<<<'HTML'
<p>
This is a CLI app built with <i>Termwind</i>.
</p>
HTML);
<s>
The <s> element can be used to add a line through the text.
Default Styles: line-through
render(<<<'HTML'
<p>
This is a CLI app built with <s>Termwind</s>.
</p>
HTML);
<br>
The <br> element can be used to do a line break.
render(<<<'HTML'
<p>
This is a CLI <br>
app built with Termwind.
</p>
HTML);
<ul>
The <ul> element can be used for an unordered list. It can only accept <li> elements as childs, if there is another element provided it will throw an InvalidChild exception.
The <ol> element can be used for an ordered list. It can only accept <li> elements as childs, if there is another element provided it will throw an InvalidChild exception.
The <dl> element can be used for a description list. It can only accept <dt> or <dd> elements as childs, if there is another element provided it will throw an InvalidChild exception.
Default Styles: block
render(<<<'HTML'
<dl>
<dt>🍃 Termwind</dt>
<dd>Give your CLI apps a unique look</dd>
</dl>
HTML);
<dt>
The <dt> element can be used as a description title. It should only be used as a child of <dl> elements.
nunomaduro/termwind thuộc nhóm Frontend trên TopGit, cùng 4 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về nunomaduro/termwind ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/nunomaduro/termwind là nguồn chính thức.
nunomaduro/termwind có bao nhiêu sao?
nunomaduro/termwind có 2.5k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/nunomaduro/termwind. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
nunomaduro/termwind có những chủ đề gì?
GitHub topics của nunomaduro/termwind: "console", "css", "php", "tailwind". TopGit xếp repo vào nhóm Frontend.
nunomaduro/termwind có phải mã nguồn mở không?
Có — nunomaduro/termwind phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/nunomaduro/termwind.
nunomaduro/termwind có trang demo không?
Dự án có trang chủ ở https://youtube.com/@nunomaduro?sub_confirmation=1. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
nunomaduro/termwind còn đang phát triển không?
Commit gần nhất trên nunomaduro/termwind là 4 tháng trước (theo timestamp GitHub). Repo có 92 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Đọc đầy đủ README ở tab phía trên.
Chưa chắc termwind có hợp với bạn?
Để ChatGPT, Claude hoặc Perplexity tìm hiểu giúp — bấm bên dưới và xem AI nói gì về termwind.