OOP approach for structural code generation.

Installs: 35

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/avastechnology/demeter

1.1.1 2025-09-16 15:32 UTC

README

PHP Version Require Latest Release License

Demeter is OOP approach for structural code generation.

The Demeter library provides an Object-Oriented approach to building the structural units required for code generation. The goal is to make it easy to generate/modify source code.

Since this library is built primarily for developer tasks, it really should not be used on production sites, rather it should be included as part of the development package set.

This is a work in progress and only feature complete as has been needed!

Installation

Include this library:

~ composer require avastechnology/demeter --dev

CSS

Parse a CSS file into components

use AVASTech\Demeter\CSS\Parser;

$parser = new Parser();

$styleSheet = $parser->parse(file_get_contents(__DIR__ . '/test.css'));

Reformat a CSS file into a pretty-print version

use AVASTech\Demeter\CSS\Parser;
use AVASTech\Demeter\CSS\Formats\Factory;

$parser = new Parser();

$styleSheet = $parser->parse(file_get_contents(__DIR__ . '/compact.css'));

file_put_contents(
  __DIR__ . '/pretty.css',
  $styleSheet->render((new Factory())->compactStyleSheet())
);

Reformat a CSS file into a compact version

use AVASTech\Demeter\CSS\Parser;
use AVASTech\Demeter\CSS\Formats\Factory;

$parser = new Parser();

$styleSheet = $parser->parse(file_get_contents(__DIR__ . '/pretty.css'));

file_put_contents(
  __DIR__ . '/compact.css',
  $styleSheet->render((new Factory())->compactStyleSheet())
);