Skip to content

Commit 062102b

Browse files
committed
Merge branch 'develop' of https://github.com/michalsn/codeigniter-signed-url into develop
2 parents a39dbcb + 5ff8083 commit 062102b

File tree

2 files changed

+25
-14
lines changed

2 files changed

+25
-14
lines changed

docs/filters.md

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,20 @@
22

33
## Overview
44

5-
To validate signed URLs we can use build in filter. We can enable it in two simple steps.
5+
To validate signed URLs we can use build in filter. We can enable it in one simple step.
66

7-
1. We have to add our filter to the `$aliases` array.
8-
2. And then define when filter should be fired up. In the example below we will assume it will be used when the first segment of the url will contain `signed-urls` string.
7+
Define when filter should be fired up. In the example below we will assume it will be used when the first segment of the url will contain `signed-urls` string.
98

109
```php
1110
// app/Config/Filters.php
1211
<?php
1312

14-
...
15-
16-
use Michalsn\CodeIgniterSignedUrl\Filters\SignedUrl;
13+
// ...
1714

1815
class Filters extends BaseConfig
1916
{
20-
...
21-
22-
public $aliases = [
23-
...
24-
'signedurl' => SignedUrl::class
25-
];
2617

27-
...
18+
// ...
2819

2920
public $filters = [
3021
'signedurl' => ['before' => ['signed-urls/*']],
@@ -43,4 +34,4 @@ More info you can find in the [Configuration](configuration.md) page.
4334

4435
!!! note
4536

46-
Remember, that if the filter implementation doesn't suit you, you can always create your own, which will behave differently upon an error. You can also not use the filter at all and make the check in the controller.
37+
Remember, that if the filter implementation doesn't suit you, you can always [create your own](https://codeigniter.com/user_guide/incoming/filters.html?highlight=filter#creating-a-filter), which will behave differently upon an error. You can also not use the filter at all and make the check in the controller.

src/Config/Registrar.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Michalsn\CodeIgniterSignedUrl\Config;
4+
5+
use Michalsn\CodeIgniterSignedUrl\Filters\SignedUrl;
6+
7+
class Registrar
8+
{
9+
/**
10+
* Register the CodeIgniterSignedUrl filter.
11+
*/
12+
public static function Filters(): array
13+
{
14+
return [
15+
'aliases' => [
16+
'signedurl' => SignedUrl::class,
17+
],
18+
];
19+
}
20+
}

0 commit comments

Comments
 (0)