Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 2 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ Developed by [Florian Eckerstorfer](https://florian.ec) in Vienna, Europe with t
characters. Instead of removing these characters, Slugify approximates them (e.g., `ae` replaces `ä`).
- No external dependencies.
- PSR-4 compatible.
- Compatible with PHP >= 5.5.9 and PHP 7.
- Integrations for [Symfony (2 and 3)](http://symfony.com), [Silex (1 and 2)](http://silex.sensiolabs.org), [Laravel](http://laravel.com),
- Compatible with PHP >= 7.
- Integrations for [Symfony (3, 4 and 5)](http://symfony.com), [Laravel](http://laravel.com),
[Twig (1 and 2)](http://twig.sensiolabs.org), [Zend Framework 2](http://framework.zend.com/), [Nette Framework](http://nette.org/),
[Latte](http://latte.nette.org/) and [Plum](https://github.com/plumphp/plum).

Expand Down Expand Up @@ -292,34 +292,6 @@ Slugify extension using a closure:
You can find more information about registering extensions in the
[Twig documentation](http://twig.sensiolabs.org/doc/advanced.html#creating-an-extension).

### Silex

Slugify also provides a service provider to integrate into Silex.

```php
// For Silex version 1
$app->register(new Cocur\Slugify\Bridge\Silex\SlugifyServiceProvider());
```

```php
// For Silex version 2
$app->register(new Cocur\Slugify\Bridge\Silex2\SlugifyServiceProvider());
```

You can use the `slugify` method in your controllers:

```php
$app->get('/', function () {
return $app['slugify']->slugify('welcome to the homepage');
});
```

And if you use Silex in combination with Twig register the `SlugifyServiceProvider` after the `Silex\Provider\TwigServiceProvider` to add the Twig extension to your environment and use the `slugify` filter in your templates.

```twig
{{ 'welcome to the homepage'|slugify }}
```

### Mustache.php

We don't need an additional integration to use Slugify in [Mustache.php](https://github.com/bobthecow/mustache.php).
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@
"phpunit/phpunit": "^5.7.27",
"pimple/pimple": "~1.1",
"plumphp/plum": "~0.1",
"silex/silex": "~1.3",
"symfony/config": "~2.4 || ~3.0 || ~4.0",
"symfony/dependency-injection": "~2.4 || ~3.0 || ~4.0",
"symfony/http-kernel": "~2.4 || ~3.0 || ~4.0",
"symfony/config": "^3.4 || ^4.3 || ^5.0",
"symfony/dependency-injection": "^3.4 || ^4.3 || ^5.0",
"symfony/http-kernel": "^3.4 || ^4.3 || ^5.0",
"twig/twig": "^1.42.4 || ^2.12.1 || ~3.0",
"zendframework/zend-modulemanager": "~2.2",
"zendframework/zend-servicemanager": "~2.2",
Expand Down
57 changes: 0 additions & 57 deletions src/Bridge/Silex/SlugifyServiceProvider.php

This file was deleted.

48 changes: 0 additions & 48 deletions src/Bridge/Silex2/SlugifyServiceProvider.php

This file was deleted.

7 changes: 1 addition & 6 deletions src/Bridge/Symfony/CocurSlugifyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\Kernel;

/**
* CocurSlugifyExtension
Expand Down Expand Up @@ -58,10 +57,6 @@ public function load(array $configs, ContainerBuilder $container)
->addTag('twig.extension')
->setPublic(false);
$container->setAlias('slugify', 'cocur_slugify');

// for symfony versions >= 3.3
if (Kernel::VERSION_ID >= 30300) {
$container->setAlias('Cocur\Slugify\SlugifyInterface', 'cocur_slugify');
}
$container->setAlias('Cocur\Slugify\SlugifyInterface', 'cocur_slugify');
}
}
62 changes: 0 additions & 62 deletions tests/Bridge/Silex/SlugifySilexProviderTest.php

This file was deleted.

4 changes: 4 additions & 0 deletions tests/Bridge/Symfony/CocurSlugifyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ public function testLoad()
->shouldReceive('setAlias')
->with('slugify', 'cocur_slugify')
->once();
$container
->shouldReceive('setAlias')
->with('Cocur\Slugify\SlugifyInterface', 'cocur_slugify')
->once();

$this->extension->load([], $container);
}
Expand Down