Skip to content

Commit 930c31c

Browse files
committed
Remove the Json view helper entirely
Signed-off-by: George Steel <george@net-glue.co.uk>
1 parent 4cd8996 commit 930c31c

File tree

7 files changed

+5
-120
lines changed

7 files changed

+5
-120
lines changed

docs/book/v3/helpers/json.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/book/v3/migration/v2-to-v3.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,6 @@ The method of configuring the resource map remains unchanged.
2727
The deprecated runtime retrieval and modification of the underlying authentication service has been removed and the service must be injected into the helper constructor.
2828
Specifically, the methods `Laminas\View\Helper\Identity::setAuthenticationService()` and `Laminas\View\Helper\Identity::getAuthenticationService()` have been removed.
2929

30-
#### Json Helper
31-
32-
The JSON view helper is now final and has no inheritance hierarchy.
33-
3430
## Removed Features
3531

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

5349
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.
5450

55-
#### Json View Helper
56-
57-
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).
58-
Support for this library and the expression finder feature has been removed.
59-
60-
In an MVC context, it was possible, in version 2, to provide a response object to the helper.
61-
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.
62-
6351
## Removed Class and Traits
6452

6553
### Removed Helpers
@@ -105,3 +93,8 @@ function gravatarImage(
10593
string $rating = 'g'
10694
);
10795
```
96+
97+
#### Json
98+
99+
The deprecated Json view helper has been removed.
100+
To encode data to Json for output in a view, you can call [`json_encode`](https://www.php.net/json_encode) directly.

mkdocs.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ nav:
6565
- HtmlTag: v3/helpers/html-tag.md
6666
- Identity: v3/helpers/identity.md
6767
- InlineScript: v3/helpers/inline-script.md
68-
- Json: v3/helpers/json.md
6968
- Layout: v3/helpers/layout.md
7069
- Partial: v3/helpers/partial.md
7170
- Placeholder: v3/helpers/placeholder.md
@@ -115,7 +114,6 @@ plugins:
115114
helpers/html-tag.md: v3/helpers/html-tag.md
116115
helpers/identity.md: v3/helpers/identity.md
117116
helpers/inline-script.md: v3/helpers/inline-script.md
118-
helpers/json.md: v3/helpers/json.md
119117
helpers/layout.md: v3/helpers/layout.md
120118
helpers/partial.md: v3/helpers/partial.md
121119
helpers/placeholder.md: v3/helpers/placeholder.md

src/Helper/Json.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/HelperPluginManager.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ class HelperPluginManager extends AbstractPluginManager
111111
'inlinescript' => Helper\InlineScript::class,
112112
'inlineScript' => Helper\InlineScript::class,
113113
'InlineScript' => Helper\InlineScript::class,
114-
'json' => Helper\Json::class,
115-
'Json' => Helper\Json::class,
116114
'layout' => Helper\Layout::class,
117115
'Layout' => Helper\Layout::class,
118116
'paginationcontrol' => Helper\PaginationControl::class,
@@ -181,7 +179,6 @@ class HelperPluginManager extends AbstractPluginManager
181179
Helper\HtmlObject::class => InvokableFactory::class,
182180
Helper\HtmlPage::class => InvokableFactory::class,
183181
Helper\InlineScript::class => InvokableFactory::class,
184-
Helper\Json::class => InvokableFactory::class,
185182
Helper\Layout::class => InvokableFactory::class,
186183
Helper\PaginationControl::class => InvokableFactory::class,
187184
Helper\PartialLoop::class => InvokableFactory::class,
@@ -217,7 +214,6 @@ class HelperPluginManager extends AbstractPluginManager
217214
'laminasviewhelperhtmlobject' => InvokableFactory::class,
218215
'laminasviewhelperhtmlpage' => InvokableFactory::class,
219216
'laminasviewhelperinlinescript' => InvokableFactory::class,
220-
'laminasviewhelperjson' => InvokableFactory::class,
221217
'laminasviewhelperlayout' => InvokableFactory::class,
222218
'laminasviewhelperpaginationcontrol' => InvokableFactory::class,
223219
'laminasviewhelperpartialloop' => InvokableFactory::class,

src/Renderer/PhpRenderer.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
* @method string htmlPage($data, array $attribs = array(), array $params = array(), $content = null)
7070
* @method mixed|null identity()
7171
* @method \Laminas\View\Helper\InlineScript inlineScript($mode = \Laminas\View\Helper\HeadScript::FILE, $spec = null, $placement = 'APPEND', array $attrs = array(), $type = 'text/javascript')
72-
* @method string json(mixed $data, array $jsonOptions = [])
7372
* @method \Laminas\View\Helper\Layout layout($template = null)
7473
* @method \Laminas\View\Helper\Navigation navigation($container = null)
7574
* @method string paginationControl(\Laminas\Paginator\Paginator $paginator = null, $scrollingStyle = null, $partial = null, $params = null)

test/Helper/JsonTest.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)