Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Update base path cookbook #285

Merged
merged 1 commit into from
Jan 27, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions doc/book/cookbook/using-a-base-path.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ configuration.
To install it:

```bash
$ composer require "mtymek/blast-base-url:dev-master@dev"
$ composer require mtymek/blast-base-url
```

To configure it, update the file `config/autoload/middleware-pipeline.global.php`,
Expand Down Expand Up @@ -127,9 +127,8 @@ the request URI and the operating system path to the application.

The primary advantage of `mtymek/blast-base-url` is in its additional features:

- it provides an override of `Zend\Expressive\Helper\UrlHelper` that is aware of
the base path, allowing you to create route-based URLs relative to the base
path.
- it injects `Zend\Expressive\Helper\UrlHelper` with the base path, allowing you
to create relative route-based URLs.
- it provides a new helper, `Blast\BaseUrl\BasePathHelper`, which allows you to
create URLs relative to the base path; this is particularly useful for assets.

Expand All @@ -143,29 +142,10 @@ return [
Blast\BaseUrl\BasePathHelper::class => Blast\BaseUrl\BasePathHelper::class,
/* ... */
],
'factories' => [
Blast\BaseUrl\UrlHelper::class => Blast\BaseUrl\UrlHelperFactory::class,
/* ... */
],
'aliases' => [
// alias default UrlHelper with Blast\BaseUrl alternative
Helper\UrlHelper::class => Blast\BaseUrl\UrlHelper::class,
/* ... */
],
],
];
```

Additionally, remove the following from the same file:

```php
'factories' => [
// Remove the following line only:
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
/* ... */
],
```

Finally, if you're using zend-view, you can register a new "basePath" helper in
your `config/autoload/templates.global.php`:

Expand Down