Skip to content

Commit

Permalink
Remove the Json view helper entirely
Browse files Browse the repository at this point in the history
Signed-off-by: George Steel <george@net-glue.co.uk>
  • Loading branch information
gsteel committed Jan 26, 2024
1 parent 4cd8996 commit 930c31c
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 120 deletions.
16 changes: 0 additions & 16 deletions docs/book/v3/helpers/json.md

This file was deleted.

17 changes: 5 additions & 12 deletions docs/book/v3/migration/v2-to-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ The method of configuring the resource map remains unchanged.
The deprecated runtime retrieval and modification of the underlying authentication service has been removed and the service must be injected into the helper constructor.
Specifically, the methods `Laminas\View\Helper\Identity::setAuthenticationService()` and `Laminas\View\Helper\Identity::getAuthenticationService()` have been removed.

#### Json Helper

The JSON view helper is now final and has no inheritance hierarchy.

## Removed Features

### Stream Wrapper Functionality
Expand All @@ -52,14 +48,6 @@ These helpers now have constructors that expect an [Escaper](https://docs.lamina

The encoding defaults to UTF-8 as it has always done but can be overridden in configuration by setting `view_manager.encoding` to your preferred value.

#### Json View Helper

In previous versions of laminas-view the [Json View Helper](helpers/json.md) made use of the [laminas-json](https://docs.laminas.dev/laminas-json/) library which enabled encoding of [JSON Expressions](https://docs.laminas.dev/laminas-json/advanced/#json-expressions).
Support for this library and the expression finder feature has been removed.

In an MVC context, it was possible, in version 2, to provide a response object to the helper.
Invoking the helper would set the appropriate response headers for a JSON payload. This is no longer possible and the method `setResponse` has been removed.

## Removed Class and Traits

### Removed Helpers
Expand Down Expand Up @@ -105,3 +93,8 @@ function gravatarImage(
string $rating = 'g'
);
```

#### Json

The deprecated Json view helper has been removed.
To encode data to Json for output in a view, you can call [`json_encode`](https://www.php.net/json_encode) directly.
2 changes: 0 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ nav:
- HtmlTag: v3/helpers/html-tag.md
- Identity: v3/helpers/identity.md
- InlineScript: v3/helpers/inline-script.md
- Json: v3/helpers/json.md
- Layout: v3/helpers/layout.md
- Partial: v3/helpers/partial.md
- Placeholder: v3/helpers/placeholder.md
Expand Down Expand Up @@ -115,7 +114,6 @@ plugins:
helpers/html-tag.md: v3/helpers/html-tag.md
helpers/identity.md: v3/helpers/identity.md
helpers/inline-script.md: v3/helpers/inline-script.md
helpers/json.md: v3/helpers/json.md
helpers/layout.md: v3/helpers/layout.md
helpers/partial.md: v3/helpers/partial.md
helpers/placeholder.md: v3/helpers/placeholder.md
Expand Down
38 changes: 0 additions & 38 deletions src/Helper/Json.php

This file was deleted.

4 changes: 0 additions & 4 deletions src/HelperPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ class HelperPluginManager extends AbstractPluginManager
'inlinescript' => Helper\InlineScript::class,
'inlineScript' => Helper\InlineScript::class,
'InlineScript' => Helper\InlineScript::class,
'json' => Helper\Json::class,
'Json' => Helper\Json::class,
'layout' => Helper\Layout::class,
'Layout' => Helper\Layout::class,
'paginationcontrol' => Helper\PaginationControl::class,
Expand Down Expand Up @@ -181,7 +179,6 @@ class HelperPluginManager extends AbstractPluginManager
Helper\HtmlObject::class => InvokableFactory::class,
Helper\HtmlPage::class => InvokableFactory::class,
Helper\InlineScript::class => InvokableFactory::class,
Helper\Json::class => InvokableFactory::class,
Helper\Layout::class => InvokableFactory::class,
Helper\PaginationControl::class => InvokableFactory::class,
Helper\PartialLoop::class => InvokableFactory::class,
Expand Down Expand Up @@ -217,7 +214,6 @@ class HelperPluginManager extends AbstractPluginManager
'laminasviewhelperhtmlobject' => InvokableFactory::class,
'laminasviewhelperhtmlpage' => InvokableFactory::class,
'laminasviewhelperinlinescript' => InvokableFactory::class,
'laminasviewhelperjson' => InvokableFactory::class,
'laminasviewhelperlayout' => InvokableFactory::class,
'laminasviewhelperpaginationcontrol' => InvokableFactory::class,
'laminasviewhelperpartialloop' => InvokableFactory::class,
Expand Down
1 change: 0 additions & 1 deletion src/Renderer/PhpRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
* @method string htmlPage($data, array $attribs = array(), array $params = array(), $content = null)
* @method mixed|null identity()
* @method \Laminas\View\Helper\InlineScript inlineScript($mode = \Laminas\View\Helper\HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
* @method string json(mixed $data, array $jsonOptions = [])
* @method \Laminas\View\Helper\Layout layout($template = null)
* @method \Laminas\View\Helper\Navigation navigation($container = null)
* @method string paginationControl(\Laminas\Paginator\Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)
Expand Down
47 changes: 0 additions & 47 deletions test/Helper/JsonTest.php

This file was deleted.

0 comments on commit 930c31c

Please sign in to comment.