1.0.2 2023-08-23 21:07 UTC

This package is auto-updated.

Last update: 2024-12-24 00:27:49 UTC


README

Build Status Latest Stable Version Total Downloads Latest Unstable Version Latest Monthly Downloads License

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:

Similar packages

  • luzzardi/php-url
  • martinmdev/php-url
  • simlux/php-url
  • thesmart/php-url

Licence

MIT (See LICENCE file)