creativeservices / fixtures
This package is abandoned and no longer maintained.
No replacement package was suggested.
Use fixture content in Twig templates
v1.0.0-beta1
2018-10-25 13:14 UTC
Requires
- php: >=7.0
- eloquent/pathogen: ^0.6.1
- erusev/parsedown: ^1.7
- symfony/yaml: ~2.7|3.*|^4.1
- twig/twig: ~1.20|~2.0
Requires (Dev)
- phpunit/phpunit: ~7.4
This package is auto-updated.
Last update: 2022-03-29 00:21:29 UTC
README
They can be used to populate templates during development. They can also serve as content sources for static site generators and style guides.
Supported formats
- JSON
- YAML
- Markdown
Usage
Create a fixture collection from a directory of fixture files:
$fixtures = FixtureCollection::fromDirectory('/path/to/fixture/files');
Get a piece of content from the collection:
$context = $fixtures['fixture-file.json'];
When the Twig extension is enabled, fixture content is available inside templates with the _fixture
function:
{% set article = _fixture('article.json') %}
{{ article.title }}