Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data JSON support #82

Merged
merged 2 commits into from
Apr 1, 2019
Merged

Data JSON support #82

merged 2 commits into from
Apr 1, 2019

Conversation

johanjanssens
Copy link
Member

This PR adds several improvements to the data objects.

1. JSON support

It's now possible to cast a data object to a string. You can do so by calling the data([..])->toString() method, or you can cast the the data object to a string <?= data([...]) ?>

2. Create a data object from an array

It's now possible to create a new data object from an associative array of data. Example

<? $data = data([
    'foo' => 'bar',
    'dog' => 'bark'
]) ?>

A none associative array is not supported. This will be interpreted as an array of data locations, see also #4

- Implement JsonSerializable
- __toString() and encode to JSON
@johanjanssens johanjanssens added this to the v0.9.0 milestone Mar 31, 2019
@johanjanssens johanjanssens self-assigned this Mar 31, 2019
@ercanozkaya ercanozkaya merged commit 02a3a4c into master Apr 1, 2019
@ercanozkaya ercanozkaya deleted the feature/81-json branch April 1, 2019 08:36
@johanjanssens johanjanssens mentioned this pull request Apr 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants