Skip to content

Commit 5be3a49

Browse files
committed
🔧 Remove url shortener facade (LaraCrafts#31)
1 parent 441352a commit 5be3a49

File tree

4 files changed

+13
-49
lines changed

4 files changed

+13
-49
lines changed

‎CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22

33
## [v0.3.0](https://github.com/LaraCrafts/laravel-url-shortener/releases/tag/v0.3.0) (TBD)
44
- Restructured config (**Breaking change**)
5+
- Removed UrlShortener facade (**Breaking change**)
56
- Added Polr driver
67

78
## [v0.2.0](https://github.com/LaraCrafts/laravel-url-shortener/releases/tag/v0.2.0) (2019-04-27)
8-
- Added `UrlShortener` facade
9+
- Added UrlShortener facade
910
- Added Is.gd driver
1011
- Added V.gd driver
1112
- Added Ouo.io driver

‎README.md

+11-18
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Powerful URL shortening tools in Laravel
1313
- [Requirements](#requirements)
1414
- [Laravel 5.5+](#laravel-55)
1515
- [Laravel 5.1-5.4](#laravel-51-54)
16-
- [Lumen](#lumen)
1716
- [Usage](#usage)
1817
- [Changing the driver](#changing-the-driver)
1918
- [Adding your own drivers](#adding-your-own-drivers)
@@ -43,7 +42,7 @@ composer require laracrafts/laravel-url-shortener
4342
This package has the following requirements:
4443

4544
- PHP 7.1 or higher
46-
- Laravel (or Lumen) 5.1 or higher
45+
- Laravel 5.1 or higher
4746

4847
### Laravel 5.5+
4948
If you use Laravel 5.5 or higher, that's it. You can now use the package, continue to the [usage](#usage) section.
@@ -60,21 +59,12 @@ this by adding the following line to your `config/app.php` file:
6059
],
6160
```
6261

63-
### Lumen
64-
If you're using Lumen, register the package's service provider by adding the following line to your `bootstrap/app.php`
65-
file:
66-
67-
```php
68-
$app->register(LaraCrafts\UrlShortener\UrlShortenerServiceProvider::class);
69-
```
70-
7162
## Usage
7263
The shortener can be retrieved from the container in two ways:
7364

7465
```php
75-
// This works in both Laravel and Lumen
7666
$shortener = app('url.shortener');
77-
// This only works in Laravel 5.2+
67+
// or...
7868
$shortener = url()->shortener();
7969
```
8070

@@ -88,13 +78,13 @@ $shortener->shorten(...);
8878
$shortener->shortenAsync(...);
8979

9080
// You can also call shortening from Laravel's url component directly
91-
app('url')->shorten(...);
81+
url()->shorten(...);
9282

9383
// or...
94-
url()->shorten(...);
84+
app('url')->shorten(...);
9585

9686
// or even...
97-
UrlShortener::shorten(...);
87+
app('url.shortener')->shorten(...);
9888
```
9989

10090
This package relies on Guzzle's promise library for its asynchronous shortening, read their
@@ -131,9 +121,12 @@ own drivers for this package. You can do this by adding the following code to a
131121
(preferably a service provider).
132122

133123
```php
134-
UrlShortener::extend('my_driver', function ($app, $config) {
135-
// Return your driver instance here
136-
});
124+
public function boot(ShortenerManager $shorteners)
125+
{
126+
$shorteners->extend('my_driver', function ($app, $config) {
127+
// Return your driver instance here
128+
});
129+
}
137130
```
138131

139132
Once you have registered your driver you can call it like any other driver.

‎composer.json

-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@
5353
},
5454
"extra": {
5555
"laravel": {
56-
"aliases": {
57-
"UrlShortener": "\\LaraCrafts\\UrlShortener\\Support\\Facades\\UrlShortener"
58-
},
5956
"providers": [
6057
"\\LaraCrafts\\UrlShortener\\UrlShortenerServiceProvider"
6158
]

‎src/Support/Facades/UrlShortener.php

-27
This file was deleted.

0 commit comments

Comments
 (0)