diff --git a/README.md b/README.md index e946d9e..1b2aeb3 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ [![License](https://img.shields.io/github/license/geoffreyrose/url-helper?style=flat-square)](https://github.com/geoffreyrose/url-helper/blob/main/LICENSE) -# PHP URL Helper -An easy-to-use PHP helper to parse out different parts of a URL +# PHP URL Helper + Laravel Facade +An easy-to-use PHP helper (and Laravel Facade) to parse out different parts of a URL ### Requirements @@ -15,15 +15,14 @@ An easy-to-use PHP helper to parse out different parts of a URL ### Usage +### Install ``` -$ composer require geoffreyrose/url-helper +composer require geoffreyrose/url-helper ``` -```php -getPathname('Dark Lord Sauron'); // null ### Run Tests ``` -$ ./vendor/bin/phpunit +./vendor/bin/phpunit // or with coverage -$ XDEBUG_MODE=coverage ./vendor/bin/phpunit +XDEBUG_MODE=coverage ./vendor/bin/phpunit ``` diff --git a/composer.json b/composer.json index 346d49c..31aef8c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,15 @@ "phpunit/phpunit": "^9.0|^10.0|^11.0", "php-coveralls/php-coveralls": "^2.5" }, - "config": { - "discard-changes": true + "minimum-stability": "dev", + "extra": { + "laravel": { + "providers": [ + "UrlHelper\\ServiceProvider" + ], + "aliases": { + "URLHelper": "UrlHelper\\Facades\\URLHelper" + } + } } } diff --git a/src/UrlHelper/Facades/URLHelper.php b/src/UrlHelper/Facades/URLHelper.php new file mode 100644 index 0000000..80d8d15 --- /dev/null +++ b/src/UrlHelper/Facades/URLHelper.php @@ -0,0 +1,11 @@ +app->singleton(\UrlHelper\UrlHelper::class, function ($app) { + return new \UrlHelper\UrlHelper(); + }); + + $this->app->alias(\UrlHelper\UrlHelper::class, 'urlhelper'); + } +}