Download the PHP package flownative/flow-resourceproxy without Composer
On this page you can find all versions of the php package flownative/flow-resourceproxy. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download flownative/flow-resourceproxy
More information about flownative/flow-resourceproxy
Files in flownative/flow-resourceproxy
Package flow-resourceproxy
Short Description A Flow package that transparently imports missing resources from a remote source
License MIT
Informations about the package flow-resourceproxy
Flownative.Flow.ResourceProxy
Description
This Flow package allows to transparently import resource data from other systems into Flow. It does this by providing an implementation that tries to fetch missing resources from a remote source. When a resource can be fetched, it is "imported" and available as usual, otherwise the system behaves as usual when a resource is missing.
Because Neos CMS is using Flow's resource management under the hood, this also works nicely for assets in Neos.
This is mostly useful for local development, as it removes the need to copy all resources to the lcoal machine along with a database dump.
Installation
The Flownative Resource Proxy is installed as a regular Flow package via Composer.
For your existing project, simply include flownative/flow-resourceproxy into
the dependencies of your Flow or Neos distribution:
composer require flownative/flow-resourceproxy
Configuration
To import, the package needs to know the base URI of the remote source and whether or not it uses subdivided hash path segments.
After setting up the configuration, clear the Fusion cache to make sure the URIs will be fetched again and can be checked for needing an import. Similarly, clearing the existing thumbnails will force the system to re-generate them.
Troubleshooting
If things don't work as expected, check the system log, the package is pretty talkative in the debug log level.
Fetched data is only imported if its SHA1 matches the one of the resource. If the remote source delivers different data (e.g. because files were optimized or replaced there), a warning is logged and the resource remains missing.
Implementation
In Flow, resource access is handled through the resource management API. These mehods would need to check for a missing resource and try to fetch it if not available locally:
StorageInterface.getStreamByResourceStorageInterface.getStreamByResourcePath(unused in a plain Neos setup)TargetInterface.getPublicPersistentResourceUri
The following are covered by the above methods:
Collection.getStreamByResourceviaStorageInterface.getStreamByResourceResourceManager.getStreamByResourceviaCollection.getStreamByResourceResourceManager.getPublicPersistentResourceUriviaTargetInterface.getPublicPersistentResourceUriResourceManager.getPublicPersistentResourceUriByHashviaTargetInterface.getPublicPersistentResourceUri
On top of that the system uses image variants and thumbnails, assuming those
exist if their metadata can be found in the database. Still, the URI for those
is fetched using the TargetInterface.getPublicPersistentResourceUri method.
This package thus advises the StorageInterface and TargetInterface to
check for missing resources and tries to "import" them as needed.
Missing resources are imported using the WritableStorageInterface API, so this
works for all writable storages.