CoordiationCSS
Menu
Docs/Installation/PHP

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.

01

Install the compiler

Run npm from the PHP project root and keep the package as a development-only dependency.

Terminal
npm init -y
npm install -D @coordiation/css
02

Create a framework entry

Keep source directives outside the public output file.

assets/css/coordiation.input.css
@coordiation;

@co-theme {
  --co-color-brand-500: oklch(62.3% 0.214 259.815);
}
03

Define development and production builds

This example scans PHP templates in public and reusable templates in views.

package.json
{
  "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"
  }
}
04

Link the generated asset

Serve the output file from the public document root and use utilities directly in PHP templates.

views/layout.php
<!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>
views/home.php
<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>
05

Build before deployment

Development watch mode recompiles after PHP template changes. CI should run the minified build before packaging the public directory.

Terminal
npm run dev

# production
npm run build

PRODUCTION 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 --content option.
  • 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.