2017 © Pedro Peláez
 

library php-styles

inline css styles generator(conditions support)

image

izica/php-styles

inline css styles generator(conditions support)

  • Monday, June 18, 2018
  • by izica
  • Repository
  • 1 Watchers
  • 1 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Install

composer require izica/php-styles

Usage

generate inline tag style, (*1)

    $sStyles = (new PhpStylesInline())->opacity(0, $sContact == '')->render();
    or
    $sStyles = styles(true)->opacity(0, $sContact == '')->render();
    or
    $sStyles = styles()->inline->opacity(0, $sContact == '')->render();

insert style, (*2)

    <div <?=$sStyles?>>
        <?=$sContact;?>
    </div>

generate style with class(class styles supports media query), (*3)

    $sClassname = (new PhpStyles())->media(0, 1024)->opacity(0, $sContact == '')->render();
    or
    $sClassname = styles()->media(0, 1024)->opacity(0, $sContact == '')->render();
    or
    $sClassname = styles()
        ->name('contact-images')
        ->media(0, 1024)
        ->set('display', 'flex'),
        ->set('align-items', 'center', $itemsCount > 4),
        ->set('align-items', 'flex-start', $itemsCount <= 4),
        ->set('color', '#ccc')
        ->opacity(0, $sContact == '')
        ->render();

insert style, (*4)

    <div class="<?=$sClassname?>">
        <?=$sContact;?>
    </div>

Documentation

  • styles() - returns PhpStyles
  • styles(true) - returns PhpStylesInline
  • PhpStyles
    • inline() - returns PhpStylesInline
    • media(sizeFrom: number, sizeTo: number)
    • set(key: string, value: string or number, condition: bool(not required)) - returns $this(if condition == false, not set)
    • render(condition: bool(not required))- returns unique class name(if condition == false, returns empty string)
    • opacity(value, condition(not required))
    • name(className: string)
  • PhpStylesInline
    • set(key: string, value: string or number, condition: bool(not required)) - returns $this(if condition == false, not set)
    • render(condition: bool(not required))- returns unique class name(if condition == false, returns empty string)
    • opacity(value, condition(not required))

The Versions

18/06 2018

dev-master

9999999-dev

inline css styles generator(conditions support)

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Golovarchuk Artyom

css php generator styles css-inline

17/06 2018

1.1

1.1.0.0

inline css styles generator(conditions support)

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Golovarchuk Artyom

css php generator styles css-inline

17/06 2018

1.0

1.0.0.0

inline css styles generator(conditions support)

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

by Golovarchuk Artyom

css php generator styles css-inline