PHPackages                             laasti/lazydata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. laasti/lazydata

ActiveLibrary[Templating &amp; Views](/categories/templating)

laasti/lazydata
===============

Provides lazy loading of data to views. Dot notation can be used.

v0.6.5(5y ago)0380[1 issues](https://github.com/laasti/lazydata/issues)1MITPHPCI failing

Since Aug 23Pushed 5y ago1 watchersCompare

[ Source](https://github.com/laasti/lazydata)[ Packagist](https://packagist.org/packages/laasti/lazydata)[ RSS](/packages/laasti-lazydata/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (20)Used By (1)

Laasti/Lazydata
===============

[](#laastilazydata)

Provides lazy loading of data to views. Dot notation can be used.

Installation
------------

[](#installation)

```
composer require laasti/lazydata

```

Usage
-----

[](#usage)

All PHP callables are supported. To pass arguments to calls, use an array like \['my\_callable', \[/\* args here \*/\]\].

Without League\\Container:

```
$data = [
    'title' => 'render_title',
    'with_arguments' => ['=my_callable', [/* args here */]],
    'with_class' => ['=my_class', 'my_function'], //or '=my_class::my_function',
    'with_object' => [$object, 'my_function'],
    'meta' => function() {
        return [
            'description' => 'My description'
        ]
    }
];

$viewdata = new Laasti\Lazydata\Data($data);
$viewdata->set('username', function() {return 'George';});

//You can use dot notation within the lazy loaded data
$viewdata->get('meta.description'); //Returns 'My description'
```

Using filters, you can define your own filter with `setFilter` or use native PHP functions that take one string argument.

```
    $data = [
        'native_example' => 'strtoupper:test', //I know, it's a stupid example :P
        'closure_example' => 'closure:Test',
    ];
    $resolver = new \Laasti\Lazydata\Resolvers\FilterResolver;
    $resolver->setFilter('closure', function($value) {
        return md5($value.'MYSALT');
    });
    $viewdata = new Laasti\Lazydata\Data($data, $resolver);

    $viewdata->get('native_example'); //Returns 'TEST'
    $viewdata->get('closure_example'); //Returns '56e29f03228697ad59822c71eb4d7750'
```

With league/container:

```
//We need to setup the ContainerResolver that comes with the package
$container = new League\Container\Container;
$container->add('Laasti\Lazydata\Resolvers\ResolverInterface', 'Laasti\Lazydata\Resolvers\ContainerResolver')->withArgument($container);
$container->add('Laasti\Lazydata\Data')->withArguments([[], 'Laasti\Lazydata\Resolvers\ResolverInterface']);

$viewdata = $container->get('Laasti\Lazydata\Data);;

$container->add('container_key', 'some value');

$viewdata->set('viewdata_key', '=container_key');
$viewdata->get('viewdata_key'); //Returns 'some value'

//Returns the value from SomeClass->myMethod();, SomeClass is resolved with the container
$viewdata->set('viewdata_callable_key', '=SomeClass::myMethod');
$viewdata->get('viewdata_callable_key');

//Returns the value from SomeClass->myMethod('George'); SomeClass is resolved with the container
$viewdata->set('viewdata_callable_args_key', ['=SomeClass::myMethod', ['George']]);
$viewdata->get('viewdata_callable_args_key');
```

The ContainerResolver falls back on the default resolver if it cannot resolve the call.

> **Note:**Does not work with league/container invokables. It is a limitation due to the way registered callables are stored, there is no way to check if a callable is registered to the container in the public API.

Contributing
------------

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

History
-------

[](#history)

See CHANGELOG.md for more information.

Credits
-------

[](#credits)

Author: Sonia Marquette (@nebulousGirl)

License
-------

[](#license)

Released under the MIT License. See LICENSE.txt file.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~105 days

Recently: every ~367 days

Total

19

Last Release

2026d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/48bb7fdba3e642d3dc668b9ff03ff949b9043f58096f3c85c13de508b53e7d68?d=identicon)[nebulousGirl](/maintainers/nebulousGirl)

---

Top Contributors

[![nebulousGirl](https://avatars.githubusercontent.com/u/1899256?v=4)](https://github.com/nebulousGirl "nebulousGirl (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/laasti-lazydata/health.svg)

```
[![Health](https://phpackages.com/badges/laasti-lazydata/health.svg)](https://phpackages.com/packages/laasti-lazydata)
```

###  Alternatives

[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)[symfony/ux-icons

Renders local and remote SVG icons in your Twig templates.

555.8M69](/packages/symfony-ux-icons)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
