Download the PHP package charged/tailwindphp without Composer

On this page you can find all versions of the php package charged/tailwindphp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tailwindphp

charged/tailwindphp

A pure-PHP port of the Tailwind CSS v4 compiler. Generate utility-class CSS at runtime — no Node.js, no build step, no npx tailwindcss.

Quick start

The compiler scans content for utility-class candidates, resolves them against the Tailwind design system declared in css, and emits compiled CSS. Output is byte-for-byte equivalent to the upstream JavaScript compiler for the supported subset.

What's supported

Use cases

Command-line use

The package ships a small tw CLI for one-off compilations and CI:

Run vendor/bin/tw --help for the full option list. Exit code 2 signals a compilation error (bad CSS, unknown plugin) so CI scripts can distinguish "user error" from "tool crash" (exit 1).

Calling from a theme

Pair with a thin integration layer that scans your templates for class candidates and writes the compiled output to a cache:

tw::extractCandidates($html) scans class="..." / className="..." attributes only. For Blade/Twig templates, cn(...) helper calls, or any other source, bring your own scanner and feed the resulting class list in via the content option above.

Real-world integrations:

Caching

tw::generate() accepts a cache option that writes compiled CSS to disk keyed by a hash of all inputs (content, css, importPaths, minify). Subsequent calls with identical inputs serve the cached file instead of recompiling. Writes are atomic (write-to-tmp + rename), so concurrent requests can't corrupt entries.

Without cacheMax, the cache grows unbounded — set a sensible cap for long-running apps with dynamic content.

Security: @import containment

When the compiler resolves @import from the filesystem, every resolved path must lie under one of the directories you explicitly list in importPaths (or the directory of the importing file). A CSS input containing @import "/etc/passwd" or @import "../../../etc/passwd" is silently refused — treated identically to "file not found" — so a compiler accepting user-supplied CSS can't be coerced into reading arbitrary files.

If you legitimately need cross-tree imports (e.g. compiling a CMS theme that references vendor CSS outside the theme directory), pass a callable resolver via importPaths:

A callable resolver bypasses the filesystem layer entirely; you own the security model for whatever it returns.

Custom plugins

Pass plugin instances directly through the compile call:

Plugins passed via the plugins option are scoped to that single compile call — they don't leak into other compilations. The legacy TailwindPHP\registerPlugin() helper still works but is deprecated; prefer the per-compile DI form above.

Inspecting the design system

For tooling, design-system explorers, or computed-style lookups:

tw::compile() returns a reusable instance — call it once and reuse for many lookups instead of paying the parse cost per call. The static tw::properties() / tw::value() / tw::colors() shortcuts internally memoize compiler instances per CSS source, so calling them in sequence in the same request is cheap.

Class-name helpers

PHP ports of the canonical JS companion libraries:

Error handling

Compiler errors throw typed exceptions under TailwindPHP\Exception\:

All extend a common TailwindException base, so you can catch broadly or specifically:

Requirements

Performance

The compiler is procedural PHP. Typical compile times on a modern machine:

Cache the output. Don't compile on every request.

Development

CI runs against PHP 8.2 / 8.3 / 8.4, plus PHPStan and a perf benchmark suite on the 8.3 leg. The benchmark suite is gated behind the TAILWINDPHP_BENCH=1 env var locally — set it if you want to run the perf-regression tests outside CI:

Default-theme parse cache

src/theme.cache.php is a pre-parsed AST of resources/theme.css, checked into the repo so PHP processes skip ~3 ms of CSS parsing on cold start. Regenerate after editing resources/theme.css (typically during an upstream Tailwind sync):

A test (tests/ThemeCacheTest.php) fails CI if the cache file goes stale — you can't forget to regenerate it.

Fixture parity suite

tests/fixtures/ holds end-to-end cases (input HTML + input CSS + expected output). tests/FixtureParityTest.php runs every fixture through the PHP compiler and asserts byte-identical output.

Each expected.css declares its provenance in a header comment:

Maintainers with Node available should periodically run the regen script to promote php-seeded fixtures to upstream and catch any drift. See tests/fixtures/README.md for the methodology.

Releasing

Releases are cut by hand. CHANGELOG.md is the source of truth: the version, the date, and the release notes all come out of it, so the only judgement call in a release is what the changelog says.

1. Land the work with a changelog entry. Any PR that changes behaviour adds an entry under ## [Unreleased] in the right Keep a Changelog category (Security, Added, Changed, Deprecated, Removed, Fixed). Write from the consumer's perspective — lead with the visible behaviour change, then one clause of mechanism if it helps. "Minified calc() no longer loses zero units, so divide-y-0 stops falling back to the unprefixed width" beats "refactored the minifier".

2. Pick the version. Tags carry a v prefix (v1.0.0, not 1.0.0).

Change Bump
Bug fix, no API change PATCH (1.0.0 → 1.0.1)
Backwards-compatible feature MINOR (1.0.0 → 1.1.0)
Breaking change MAJOR (1.0.0 → 2.0.0)
Pre-release of the next version 1.1.0-beta1 → 1.1.0-beta2 → 1.1.0

Watch for changes that look minor but are breaking: adding a required argument, tightening a return type, changing the shape of a returned array, renaming a public class, removing a @deprecated API, or raising the minimum PHP version.

3. Open a promotion PR. On its own branch, edit CHANGELOG.md only:

Title it CHANGELOG: promote Unreleased → X.Y.Z. Keeping this separate from the code PR means merging it is the deliberate act that says "ship this" — nothing releases as a side effect of landing a fix.

4. Merge it, then tag. Not before: a tag is immutable and Packagist mirrors it within about 30 seconds, so a tag on the wrong commit is public before you can undo it. Confirm CI is green on main first.

5. Cut the GitHub Release. The notes are the changelog section you just promoted — copy the body of ## [X.Y.Z] (everything up to the next ## heading) into a file and pass it as --notes-file. Add --prerelease when the version carries a -beta/-rc suffix.

--verify-tag makes the command fail rather than invent a tag if step 4 didn't land.

6. Packagist syncs itself. The GitHub App picks up the new tag in roughly 30 seconds — there's nothing to trigger. Confirm with:

Downstream consumers then pick it up with composer update charged/tailwindphp.

Credits

The PHP port of Tailwind v4's compiler originated as tailwindphp/tailwindphp by Dennis Josek. Substantial credit for the original implementation goes to Dennis — this package preserves his copyright as required by the MIT license.

Charged maintains this distribution to power the Charged UI component ecosystem across Drupal, WordPress, and other PHP CMS targets. It ships with cascade fixes, a configurable forms plugin, and a :where()-safe minifier on top of the original port.

Tailwind CSS itself is designed and maintained by Tailwind Labs, Inc. under the MIT license. This port carries the same license.

License

MIT. See LICENSE. Copyright (c) Dennis Josek (original port author) and Charged.


All versions of tailwindphp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package charged/tailwindphp contains the following files

Loading the files please wait ...