fiko/no-object

Not Only Object will return NULL instead of error for undefined property.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/fiko/no-object

2.0.0 2026-02-09 00:38 UTC

This package is auto-updated.

Last update: 2026-02-09 08:19:19 UTC


README

It's an object that will return what it's value (only if it has value), but returns NULL if no property or no method found on this object. In an ordinary object you will get an error when calling an undefined property or method, that is why this repo was created, to resolve that problem.

How to Use?

Composer

use Fiko\NoObject\NoObject;

$data = new NoObject([
    "first" => "The first array value.",
    "last"  => "The last array value."
]);

// print all object properties
print_r($data);

// Example of calling undefined property
echo $data->wrong;

// Example of calling defined property
echo $data->first;

Via Composer

Please see example/composer.php example

Manually

Please see example/manual.php example

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT