PHPackages                             nextmotion/google-cloud-storage-fal - 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. nextmotion/google-cloud-storage-fal

ActiveTypo3-cms-extension

nextmotion/google-cloud-storage-fal
===================================

Google Cloud Storage FAL driver for TYPO3

3.0.1(10mo ago)82.3k4[1 issues](https://github.com/nextmotion/google-cloud-storage-fal/issues)GPL-2.0-or-laterPHPPHP ^8.2

Since Oct 8Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/nextmotion/google-cloud-storage-fal)[ Packagist](https://packagist.org/packages/nextmotion/google-cloud-storage-fal)[ Docs](http://github.com/nextmotion/google-cloud-storage-fal)[ RSS](/packages/nextmotion-google-cloud-storage-fal/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (30)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/d1df57030efb5ad63ba4ba63dbe3faf72f28038321dc2655c05f90405c775d1e/687474703a2f2f706f7365722e707567782e6f72672f6e6578746d6f74696f6e2f676f6f676c652d636c6f75642d73746f726167652d66616c2f76)](https://extensions.typo3.org/extension/google_cloud_storage_fal)[![TYPO3 13](https://camo.githubusercontent.com/2cf6570821614808899422f68a66a381a2de1dd0746ba9cdba6155def1f4f396/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31332d6f72616e67652e737667)](https://get.typo3.org/version/13)[![TYPO3 12](https://camo.githubusercontent.com/08afacc49187e63c796f7d1c4401d0f0563bab574d9c525312b2827acb09a7c5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31322d6f72616e67652e737667)](https://get.typo3.org/version/12)[![TYPO3 11](https://camo.githubusercontent.com/5432de37ab8517e6d9e6f803a2e1a7674a308c6d93896fe8a6fbc8a4cb50aece/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31312d6f72616e67652e737667)](https://get.typo3.org/version/11)[![TYPO3 10](https://camo.githubusercontent.com/614ff8ea70de89b6c0ffa951832460b9b407e0c321814a05fe00c02fe6999487/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5459504f332d31302d6f72616e67652e737667)](https://get.typo3.org/version/10)[![Total Downloads](https://camo.githubusercontent.com/aaced5ca605a0ee99161086405eed4554ebd10763ac1e6df0398c55610688f92/68747470733a2f2f706f7365722e707567782e6f72672f6e6578746d6f74696f6e2f676f6f676c652d636c6f75642d73746f726167652d66616c2f642f746f74616c)](https://packagist.org/packages/nextmotion/google-cloud-storage-fal)[![Monthly Downloads](https://camo.githubusercontent.com/16de94ff2141cdab366a438a117fcec5f9c815a472966a4ae4be42af65dd892d/68747470733a2f2f706f7365722e707567782e6f72672f6e6578746d6f74696f6e2f676f6f676c652d636c6f75642d73746f726167652d66616c2f642f6d6f6e74686c79)](https://packagist.org/packages/nextmotion/google-cloud-storage-fal)

TYPO3 Google Cloud Storage FAL driver.
======================================

[](#typo3-google-cloud-storage-fal-driver)

This FAL (FileAbstractionLayer) driver allows you to use Google Cloud Storage Buckets in TYPO3 for your assets instead of a local file system. It relies on `google/cloud-storage` library to connect to Google.

**Features:**

- Full support of all operations (rename, copy, move, folders, files e.g.).
- Full support of "\_recycler\_" folder.
- Supports multiply buckets &amp; multiply service accounts.
- Stores processed images in google cloud storage.
- Google login credentials can be configured by JSON, ENV or TYPO3 backend.
- Supports base URL configuration per bucket (e.g. for ).
- Supports direct to google storage added files (without using Filelist module).
- Simulates folders, even if google cloud storage is a flat filesystem.
- It comes with caching strategy for higher performance.
- Migration command to move files from another storage to google cloud storage

It gives you the power to use TYPO3 "cloud native" instead of "cloud ready" on Google Cloud Platform (GCP).

Installation
============

[](#installation)

The extension should be installed via Composer

```
composer require nextmotion/google-cloud-storage-fal

```

Configuration
-------------

[](#configuration)

Google Cloud Storage Configuration
----------------------------------

[](#google-cloud-storage-configuration)

First of all you have to create a bucket on google cloud platform. Second you have to create a private/public key to access the bucket. This driver only supports accesses on a uniform bucket level.

### CORS Header

[](#cors-header)

To use the TYPO3 crop editor, the CORS headers of the bucket must be configured.

Create a file CORS.json and modify to your needs:

```
[
    {
      "origin": ["*"],
      "method": ["GET", "POST", "OPTIONS", "HEAD"],
      "responseHeader": ["Authorization", "Origin", "X-Requested-With", "Content-Type", "Accept"],
      "maxAgeSeconds": 3600
    }
]

```

***Warning***: `"origin": ["*"]` means wide open configuration. It's more secure to define your domains e.g. `"origin": ["subdomain.domain.tld", "local.dev" ... ] `

Use the command `gsutil cors` to configure CORS in a bucket:

```
# Log-in into your account.
gcloud auth login [MY_ACCOUNT]

# List your projects
gcloud projects list

# Choose project
gcloud config set project [PROJECT_NAME]

# List your buckets
gsutil ls

# Update CORS of your bucket
gsutil cors set CORS.json gs://[BUCKET_NAME]

```

If you want to remove CORS, see:

TYPO3 Configuration
-------------------

[](#typo3-configuration)

First create a [file storage](https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/Fal/Administration/Storages.html).

All configuration fields supports `%env(ENV_VALUE_NAME)%` syntax.

### Using key file

[](#using-key-file)

[![](Documentation/Screenshots/driver-configuration-json-key-file.png)](Documentation/Screenshots/driver-configuration-json-key-file.png)

### Using key file content

[](#using-key-file-content)

[![](Documentation/Screenshots/driver-configuration-json-key-value.png)](Documentation/Screenshots/driver-configuration-json-key-value.png)

Local `1:_processed_` vs. remote `_processed_` images
-----------------------------------------------------

[](#local-1_processed_-vs-remote-_processed_-images)

It's up to you and depends on your needs where you want to save your *processed* images.

If you are trying to develop a cloud-native TYPO3, it makes a lot of sense to store *processed* images in the Google Cloud Store as well. Once an image is processed, any instance of your TYPO3 can access it.

Migrate existing files to google cloud storage
==============================================

[](#migrate-existing-files-to-google-cloud-storage)

!!! **WARNING:** *Backup your TYPO3 database and files before.*!!!

Use CLI command `googlecloudstorage:move` to move files from existing storage and keep references.

TYPO3 Version &lt; 12:

```
vendor/bin/typo3cms googlecloudstorage:move 1 2

```

TYPO3 Version &gt;= 12:

```
vendor/bin/typo3 googlecloudstorage:move 1 2

```

Usually `1` is the local file storage and in this example `2` is the Google Cloud Storage bucket.

1. This command read every record in sys\_file table with the source storage id (`1`). (Before you start please make sure, that all files are indexed. You can use the planer task "File Abstraction Layer: Update storage index".)
2. The process download each file from the source to local temp directory.
3. Upload the file from to temp directory the destination storage.
4. Exchanges storage id in the sys\_file.
5. Deletes the file in source storage (`1`).

After finishing the command you must clear the processed\_files with the module "Maintenance &gt; Remove Temporary Assets &gt; Scan temporary files &gt; Delete files in *processed*".

*Note: Due technical limitations the created and modified date will set to the current timestamp.*

```
vendor/bin/typo3 googlecloudstorage:move [-f|--force [FORCE]] [--filter FILTER] [--limit LIMIT] [--exclude EXCLUDE] [--]

Usage:
  googlecloudstorage:move [options] [--]
  google_cloud_storage_fal:googlecloudstorage:move

Arguments:
  source                 Source storage identifier
  target                 Target storage identifier

Options:
  -f, --force[=FORCE]    never prompt
                          • [default: false]
      --filter=FILTER    Filter pattern with possible wild cards, --filter="%.pdf"
                          • [default: ""]
      --limit=LIMIT      Add a possible offset, limit to restrain the number of files. e.g. 0,100
                          • [default: ""]
      --exclude=EXCLUDE  Exclude pattern, can contain comma separated values e.g. --exclude="/apps/%,/_temp/%"
                          • [default: ""]

```

Limitations
===========

[](#limitations)

- Supports only uniform buckets-level access. Read more at .

Requirements &amp; compatibility
================================

[](#requirements--compatibility)

EXT:google-cloud-storage-fal versionTYPO3 supportPHP support`>= 3.0``13``>=8.2``>= 2.0``12``>=8.1``>= 1.0``10`, `11``>=7.1,
