Download the PHP package melia/object-storage without Composer

On this page you can find all versions of the php package melia/object-storage. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package object-storage

ObjectStorage

A lightweight, file-based object store for PHP that persists object graphs by UUID, supports lazy loading, parent auto-updates, and handles deeply nested structures. Includes a simple viewer UI for exploring stored objects.

Changelog

Changes for each release will be documented in the Changelog file.

Installation

Quick Start

How It Works

Lazy Loading

Tip: Use union types to enable lazy loading where desired, e.g.:

If the property type is a concrete class without LazyLoadReference, the loader eagerly resolves and sets the real object.

Parent Auto-Updates

When a lazy reference loads, it:

Nested Objects

Viewer UI

General

Locking (use LockAdapter)

Use when you need explicit control over concurrent access (e.g., long-running writes, cross-process coordination). ObjectStorage uses the lock adapter internally in store/load/delete; call these for advanced scenarios.

When to use:

State (use StateHandler)

Use when you need to gate operations globally (e.g., fail-safe after corruption) or query/process-wide state.

Lifetime (TTL)

Locking, Caching, Safe Mode

Unknown Classes: Automatic Aliasing

If a class recorded in metadata does not exist at load time, the storage creates a class alias dynamically so the object can still be instantiated. This keeps old data readable even when types moved or were renamed (ensure you reintroduce real classes or map aliases as part of migrations when possible).

Best Practices

Object Storage Lifecycle Events

The object storage emits lifecycle events around critical operations. You can subscribe to these events to implement indexing, auditing, metrics, cache invalidation, background jobs, etc.

Event names

Event constants are defined in melia\ObjectStorage\Event\Events.

Context payloads

Listeners receive a context object implementing melia\ObjectStorage\Event\Context\ContextInterface. Common contexts include:

Note: Some events (like CACHE_CLEARED or SAFEMODE* and lock events) may have no contextual UUID.

Subscribing to events

You can get the dispatcher via the AwareTrait (getEventDispatcher/setEventDispatcher) and register listeners:

Example Storing and Loading

UUID Assignment After Store

Recommendation: implement melia\ObjectStorage\UUID\AwareInterface on your objects if you want the UUID to be assigned back onto the instance (via setUUID) and retrievable later (via getUUID).

Policies

When you call store($object), ObjectStorage persists the root object and may also persist any child objects it discovers while walking the object graph (i.e., referenced objects that become their own UUID-backed records). The Child Persistence Policy controls when those child objects are written to disk.

This is useful because, depending on your use case, you may want child objects to be:

Child persistence policy

Property persistence policy

Property hydration policy

Property Hydration

The strategy itself controls how the properties are hydrated. See StrategyInterface::hydrateProperty() for details.

Example Locking

Example Event Listener

Why resources and closures are not serialized

Object graphs can include values that aren’t portable or safely reconstructible outside the current PHP process. Two notable cases:

Resources

Examples: file handles, sockets, database connections.

Closures (anonymous functions)

Library behavior

Design guideline

Persist data, not live process artifacts. Keep serialization deterministic and reconstructible from plain values.

Generators and Iterables

Here’s an updated README section you can use.

Object Serialization Lifecycle

This library uses PHP 7.4+ magic methods __serialize() and __unserialize() for custom persistence hooks. We no longer use __sleep() or __wakeup() since these will be deprecated in PHP 8.5.

Implement

Notes

Class Rename Map

Map old class names to new ones so stored objects keep loading after refactors.

Usage

Tips

Command Line Interface

See CLI Documentation

License

AGPL-3.0


All versions of object-storage with dependencies

PHP Build Version
Package Version
Requires php Version >=8.5
ext-json Version *
symfony/console Version ^6.0
psr/simple-cache Version ^3.0
symfony/cache Version ^6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package melia/object-storage contains the following files

Loading the files please wait ...