crwlrsoft / url Goto Github PK
View Code? Open in Web Editor NEWSwiss Army knife for urls.
Home Page: https://www.crwlr.software/packages/url
License: MIT License
Swiss Army knife for urls.
Home Page: https://www.crwlr.software/packages/url
License: MIT License
Hi!
I just tried to install this package in a fresh Laravel application, but was greeted by the message that it could not satisfy my composer lock file, as the psr/http-message package was locked at v2 and this package only allows v1.
When I look at the release notes, it should be fine to include v2 as well. Other packages seem to support both v1 and v2 at the same time.
I can lock the psr/http-message to v1 in my project, but I think it will be better to follow the latest releases.
Would be great if this is possible.
The Url class should implement the PSR-7 UriInterface for compatibility reasons.
It is often necessary to update just one parameter in a query, for example:
$url = new Url($link);
$params = $url->queryArray();
$params['foo'] = 'bar';
$url->queryArray($params);
It would be great to do this in one call:
$url = new Url($link);
$url->queryParam('foo', 'bar');
And also the getter:
$url = new Url($link);
$url->queryParam('foo', 'bar');
And also for removal:
$url = new Url($link);
$url->queryParam('foo', null);
// or
$url->removeQueryParam('foo');
When I parse an URL that contains an umlaut I get an InvalidUrlException
.
Steps to reproduce:
Url::parse('https://www.example.com/bürokaufmann')
Error message:
https://www.example.com/bürokaufmann is not a valid url.
Converting a query string to array uses PHP's parse_str()
function, but this function seems to be a little outdated. Because dots and spaces aren't allowed in PHP variables it replaces all of them in keys and values to underscores. This behavior should only be necessary when you want to parse a query string to separate variables, which is obviously not a good practice and is a deprecated use of this function since PHP 7.2.0 (http://php.net/manual/en/function.parse-str.php#refsect1-function.parse-str-changelog).
So a workaround for this should be implemented because it can lead to wrong keys or values when using the queryArray
method of the Url
class.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.