2017 © Pedro Peláez
 

library sluggak

image

rudak/sluggak

  • Thursday, December 29, 2016
  • by rudak
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Sluggak

Simple static slug library and twig extension for easy slug rendering., (*1)

How to install

composer require rudak/sluggak

How it works

Just include the namespace, (*2)

use Rudak\Sluggak\Sluggak;

Just use the slugThis static method like this, (*3)

echo Sluggak::slugThis("J'ai vraiment de l'énergie à vendre !");
// ==> j-ai-vraiment-de-l-energie-a-vendre

You can also change the separator before make the job, (*4)

Sluggak::setSeparator('_');
echo Sluggak::slugThis("J'ai vraiment de l'énergie à vendre !");
// ==> j_ai_vraiment_de_l_energie_a_vendre

You can also chain it like this, (*5)

echo Sluggak::getInstance()->setSeparator('_')->slugThis("J'ai vraiment de l'énergie à vendre !");
// ==> j_ai_vraiment_de_l_energie_a_vendre

Twig integration

You can slug a string directly in your views. Just add it to your services.yml, (*6)

app.twig_extension:
    class: Rudak\Sluggak\Twig\AppExtension
    public: false
    tags:
        - { name: twig.extension }

And use it like this :, (*7)

{{ "your string"|slug }}  => your-string

That's all !, (*8)

The Versions

29/12 2016

dev-master

9999999-dev

  Sources   Download

21/12 2016

1.0.0

1.0.0.0

  Sources   Download