Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to modify options without creating a new object #133

Merged
merged 4 commits into from
Aug 16, 2016
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Also update the README.md file to document the new feature.
leofeyer committed Aug 12, 2016
commit 61a311eac87c7fe57235256991e2ace1ba7591cd
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -124,6 +124,23 @@ $slugify = new Slugify(['separator' => '_']);
$slugify->slugify('Hello World'); // -> "hello_world"
```

### Changing options on the fly

You can overwrite any of the above options on the fly by passing an options array as second argument to the `slugify()`
method. For example:

```php
$slugify = new Slugify();
$slugify->slugify('Hello World', ['lowercase' => false]); // -> "Hello-World"
```

You can also modify the separator this way:

```php
$slugify = new Slugify();
$slugify->slugify('Hello World', ['separator' => '_']); // -> "hello_world"
```

### Contributing

Feel free to ask for new rules for languages that is not already here.