Cms
Craft CMS
Tailwind CSS v3 & v4 standalone CLI wrapper for PHP projects without Node.js dependency
Zero-Node Tailwind CSS v3 & v4 CLI Integration for PHP
PHPWind is a standalone, lightweight PHP library that brings Tailwind CSS v4 and v3 to any PHP application without requiring Node.js, npm, or npx.
It automatically detects your Operating System and CPU architecture, downloads the official standalone Tailwind CSS CLI executable from GitHub Releases, and manages compilation, watching, and asset cache busting seamlessly.
package.json, node_modules, or npm required.v4.0.0, v3.4.17, etc.).vendor/bin/phpwind with build, watch, init, and clean.<link> tag generation with MD5 cache busting.phpwind:build, phpwind:watch, phpwind:init, phpwind:clean), and Blade directive @phpwind.PHPWindBundle): Native Bundle, Twig extension {{ phpwind_css() }}, and Console commands (bin/console phpwind:*).composer require phpwind/phpwind
Once installed, the CLI binary is available at vendor/bin/phpwind.
vendor/bin/phpwind init
vendor/bin/phpwind build -i resources/css/app.css -o public/css/app.css
vendor/bin/phpwind build -i resources/css/app.css -o public/css/app.css --minify
vendor/bin/phpwind watch -i resources/css/app.css -o public/css/app.css
vendor/bin/phpwind clean
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My PHP Application</title> <?php echo phpwind_css('css/app.css'); ?> </head> <body> <h1 class="text-3xl font-bold text-sky-500 underline"> Hello Tailwind CSS! </h1> </body> </html>
Register PHPWindBundle in config/bundles.php:
return [ PHPWind\Symfony\PHPWindBundle::class => ['all' => true], ];
php bin/console phpwind:init
php bin/console phpwind:build --minify
php bin/console phpwind:watch
php bin/console phpwind:clean
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> {{ phpwind_css('css/app.css') }} </head> <body class="bg-slate-900 text-white"> <h1 class="text-3xl font-bold text-sky-400">Symfony + PHPWind</h1> </body> </html>
php artisan phpwind:init php artisan phpwind:build php artisan phpwind:watch php artisan phpwind:clean
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> @phpwind('css/app.css') </head> <body class="bg-slate-900 text-white flex items-center justify-center h-screen"> <div class="p-8 bg-slate-800 rounded-xl shadow-2xl"> <h1 class="text-2xl font-bold text-teal-400">Laravel + PHPWind</h1> </div> </body> </html>
PHPWind exposes a clean PHP API for advanced use cases and framework integrations.
use PHPWind\Compiler\TailwindCompiler; use PHPWind\Config\PHPWindConfig; $config = new PHPWindConfig( inputCss: 'resources/css/app.css', outputCss: 'public/css/app.css', version: 'v4.0.0', minify: true ); $compiler = new TailwindCompiler(); // Backward-compatible exit code $exitCode = $compiler->compile($config); // Or use compileResult() for structured output $result = $compiler->compileResult($config); echo "Compiled in {$result->durationMs}ms with exit code {$result->exitCode}";
use PHPWind\Binary\BinaryManager; $manager = new BinaryManager('vendor/bin/tailwind-cli'); $binaryPath = $manager->resolveBinaryPath('v4.0.0'); // Switching versions automatically fetches the correct binary: $binaryPath = $manager->resolveBinaryPath('v3.4.17'); // Clean cached binaries $manager->clearCachedBinary(); // all versions $manager->clearCachedBinary('v4.0.0'); // specific version
use PHPWind\Config\PHPWindConfig; use PHPWind\Exception\InvalidConfigurationException; try { $config = new PHPWindConfig(version: 'not-a-version'); $config->validate(); } catch (InvalidConfigurationException $e) { echo $e->getMessage(); }
For CDN deployments or when you need persistent asset versioning, generate a JSON manifest:
use PHPWind\Manifest\AssetManifest; $manifest = AssetManifest::generate('public', ['css/app.css']); $manifest->write('public/phpwind-manifest.json');
Then render versioned URLs from the manifest:
use PHPWind\Helper\AssetHelper; use PHPWind\Manifest\AssetManifest; $manifest = AssetManifest::read('public/phpwind-manifest.json'); echo AssetHelper::cssFromManifest($manifest, 'css/app.css'); // <link rel="stylesheet" href="/css/app.css?v=a1b2c3d4">
[!NOTE]
AssetHelper::css()continues to work with query-string cache busting by default. The manifest is opt-in.
vendor/bin/phpunit tests
The test suite covers platform resolution, binary download/management, compilation orchestration, configuration validation, asset helpers, and framework integrations.
┌────────────────────────────────┐
│ PHPWind CLI / Helper │
└───────────────┬────────────────┘
│
Is binary installed locally?
│
┌───────────────┴────────────────┐
│ NO │ YES
▼ ▼
┌───────────────────────────┐ ┌───────────────────────────┐
│ PlatformResolver & │ │ Runner (proc_open) │
│ Downloader │ │ │
│ Fetches OS/Arch binary │ │ Executes binary with │
│ from GitHub Releases │ │ -i, -o, --minify │
└─────────────┬─────────────┘ └─────────────┬─────────────┘
│ │
└─────────────────┬───────────────┘
▼
┌───────────────────────────────┐
│ Compiled Output (app.css) │
└───────────────────────────────┘
This project is licensed under the MIT License.
Craft CMS
Composer helps you declare, manage and install dependencies of PHP projects. It ensures you have the right stack everywhere.
PHPMailer is a full-featured email creation and transfer class for PHP
Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS
Nueva versión disponible.