https://github.com/flownative/flow-resourceproxy
A Flow package that transparently imports missing resources from a remote source
https://github.com/flownative/flow-resourceproxy
Last synced: 3 months ago
JSON representation
A Flow package that transparently imports missing resources from a remote source
- Host: GitHub
- URL: https://github.com/flownative/flow-resourceproxy
- Owner: flownative
- License: mit
- Created: 2021-12-09T10:46:49.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-09T08:48:23.000Z (6 months ago)
- Last Synced: 2025-08-28T14:46:12.207Z (4 months ago)
- Language: PHP
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](http://opensource.org/licenses/MIT)
[](https://packagist.org/packages/flownative/flow-resourceproxy)
[](https://packagist.org/packages/flownative/flow-resourceproxy)
[](https://www.flownative.com/en/products/open-source.html)
# Flownative.Flow.ResourceProxy
## Description
This [Flow](https://flow.neos.io) 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](https://www.neos.io) 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.
```yaml
Flownative:
Flow:
ResourceProxy:
storages:
# the default storage for a Flow setup
'defaultPersistentResourcesStorage':
# the remote base URI to the published resources
remoteSourceBaseUri: 'https://www.acme.com/_Resources/Persistent'
# whether or not the remote source uses the target setting of the same name
subdivideHashPathSegment: true
```
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.
## 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.getStreamByResource`
- `StorageInterface.getStreamByResourcePath` (unused in a plain Neos setup)
- `TargetInterface.getPublicPersistentResourceUri`
The following are covered by the above methods:
- `Collection.getStreamByResource` via `StorageInterface.getStreamByResource`
- `ResourceManager.getStreamByResource` via `Collection.getStreamByResource`
- `ResourceManager.getPublicPersistentResourceUri` via `TargetInterface.getPublicPersistentResourceUri`
- `ResourceManager.getPublicPersistentResourceUriByHash` via `TargetInterface.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.
Note: So far this only works for the `WritableFileSystemStorage`.