Skip to content

hielsnoppe/phpcss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPCSS

Scrutinizer Code Quality Code Coverage Build Status

This is a PHP library to easily create valid CSS.

Current state and roadmap

This library is currently under active development. The next milestone is a stable release (version 1.0.0) with a reduced feature set. Later it is planned to support converting CSS selectors to XPath aswell as writing rules from stylesheets inline.

Installation

To install this library via Composer add the following to your composer.json and then run composer update:

{
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/hielsnoppe/phpcss.git"
        }
    ],
    "require": {
        "hielsnoppe/phpcss": "0.1.11"
    }
}

This library will be available on Packagist as soon as version 1.0.0 is released.

Usage

Given that you have the Composer autoloader in place, you can use PHPCSS as follows:

<?php

use \NielsHoppe\PHPCSS\Document;
use \NielsHoppe\PHPCSS\Rules\StyleRule;

$style = new Document();

$html = new StyleRule('html');
$html->createDeclaration('color', '#00f');

$body = new StyleRule('body');
$body->createDeclaration('background-color', 'rgba(128, 255 , 0, 0.5)');
$body->createDeclaration('padding-top', '10px');

$style->addRule($html);
$style->addRule($body);

echo($style);

Documentation and testing

You can create documentation with phpDocumentor as follows:

$ composer docs

This will create extensive HTML documentation in the docs/ folder.

You can run the PHPUnit tests as follows:

$ composer test

About

PHP library to easily create valid CSS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages