Comments (4)
I think you're right, filter()
's parameters are getting pretty long and the order isn't necessarily sorted by what's needed most often. Not wanting to break compatibility, for now I've added a new slug()
method with the following parameters:
public static function slug ($string, $maxLength = 200, $separator = '-', $language = 'en')
Hopefully that's easier to remember and use for more common cases :)
from urlify.
Ah, I must have missed that parameter changing to $separator in a PR, but it looks like you can accomplish the same thing with the separator. I just tested this code:
<?php
require 'vendor/autoload.php';
echo URLify::filter ('some_text here', 200, 'en', false, false, true, '-') . PHP_EOL;
echo URLify::filter ('some_text here', 200, 'en', false, false, true, ' ') . PHP_EOL;
And the output is:
some-text-here
some text here
I suppose what was lost was the ability to set it to false in order to preserve underscores (e.g., "some_text-here").
from urlify.
OK, thanks a lot for the quick response and explanation! That solution also works!
I wasn't sure if it had a reason but you optimized it a lot (which I was doing in the old version) so I was a little bit flabbergasted, sorry for that :)
Does it stay this way or are you going to change/optimize what I described ? Maybe the arg order could be optimized ?
from urlify.
@lux Can't say more... Understood, sure, Superb! Thanks!
(I don't know where the zero's come from, can't backspace them as I don't see them)
0000000000000000
from urlify.
Related Issues (20)
- Ó => o HOT 1
- stop after & symbol HOT 3
- preserve case feature HOT 1
- Please retain license HOT 1
- Unable to urlify properly HOT 2
- Replacing underscores with spaces HOT 1
- Wider language support for transliteration? HOT 1
- Support more characters by default HOT 1
- save file extension when $file_name = true HOT 1
- Lithuanian map :) HOT 1
- Make use of PHP's Transliterator class HOT 3
- Missing A char HOT 2
- Passing certain characters to add_chars() method causes "preg_match_all(): Unknown modifier ']'" HOT 1
- how to reverse url slug HOT 1
- All word lowercase
- Not compatable with Laravel 9 HOT 7
- 1.2.4 changed transliteration behaviour HOT 2
- Difficulty generating a slug with / and , HOT 1
- Underscores as spaces HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from urlify.