INSTALLATION · PHP
Using PHP
Compile Coordiation beside your PHP application. The scanner understands .php templates and produces a static CSS asset your server can deliver normally.
Node.js is needed only on the development or CI machine. The deployed PHP application receives ordinary CSS and does not run Coordiation in the browser.
Install the compiler
Run npm from the PHP project root and keep the package as a development-only dependency.
npm init -y
npm install -D @coordiation/cssCreate a framework entry
Keep source directives outside the public output file.
@coordiation;
@co-theme {
--co-color-brand-500: oklch(62.3% 0.214 259.815);
}Define development and production builds
This example scans PHP templates in public and reusable templates in views.
{
"scripts": {
"dev": "coordiation-css -i assets/css/coordiation.input.css -o public/assets/coordiation.css --content public --content views --watch",
"build": "coordiation-css -i assets/css/coordiation.input.css -o public/assets/coordiation.css --content public --content views --minify"
},
"devDependencies": {
"@coordiation/css": "0.1.0"
}
}Link the generated asset
Serve the output file from the public document root and use utilities directly in PHP templates.
<!doctype html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/assets/coordiation.css" />
</head>
<body class="co-bg-white co-text-black">
<?= $content ?>
</body>
</html><main class="co-grid co-min-h-screen co-place-items-center">
<h1 class="co-text-6xl co-font-bold">
<?= htmlspecialchars($title, ENT_QUOTES, "UTF-8") ?>
</h1>
</main>Build before deployment
Development watch mode recompiles after PHP template changes. CI should run the minified build before packaging the public directory.
npm run dev
# production
npm run buildPRODUCTION CHECKLIST
Ship predictable CSS
Keep the scanner boundary and generated stylesheet explicit so people, CI, and AI agents produce the same result.
Open PHP templates documentation →- Include every PHP template directory with a repeatable
--contentoption. - Deploy
public/assets/coordiation.css; Node.js is not required on the PHP server. - Keep PHP conditions mapped to complete literal class strings.
- Generate the stylesheet before an immutable or read-only deployment artifact is created.
