transprime-research / php-url
Urls in PHP made easy
1.0.2
2023-08-23 21:07 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpunit/phpunit: ~8.0
This package is auto-updated.
Last update: 2024-10-24 00:06:11 UTC
README
About PHP-URL
This works this way
Do it Like a PRO 🆗
Installation
composer require transprime-research/php-url
Quick Usage
Use it like this...
$url = new Url( fullDomain: 'http://localhost:8080', path: '/api/hello', query: ['name' => 'John', 'public' => 'yes'], ); // Or $url = Url::make( scheme: 'http://', domain: 'localhost', port: '8080', path: '/api/hello', query: ['name' => 'John', 'public' => 'yes'], ); (string) $url; // http://localhost:8080/api/hello?name=John&public=yes $url->toString(); // http://localhost:8080/api/hello?name=John&public=yes
Other Usages
$url = Url::make() ->setScheme('http://') ->setDomain('localhost') ->setPort('8080') ->setPath('/api/hello') ->addToQuery('name', 'John') ->addToQuery('public', 'yes'); (string) $url; // http://localhost:8080/api/hello?name=John&public=yes
Coming Soon
Api implementation to be decided
Additional Information
See other packages in this series here:
- https://github.com/omitobi/conditional [A smart PHP if...elseif...else statement]
- https://github.com/transprime-research/piper [A functional PHP pipe in object-oriented way]
- https://github.com/transprime-research/arrayed [Array now an object]
- https://github.com/transprime-research/attempt [A smart PHP try...catch statement]
- https://github.com/omitobi/corbonate [A smart Carbon + Collection package]
- https://github.com/omitobi/laravel-habitue [Jsonable Http Request(er) package with Collections response]
Similar packages
- luzzardi/php-url
- martinmdev/php-url
- simlux/php-url
- thesmart/php-url
Licence
MIT (See LICENCE file)