Flysystem and Silverstripe CMS

Flysystem and Silverstripe CMS

Lightning talk at StripeCon EU 2019. A quick overview about Flysystem and it's integration into Silverstripe CMS

9748d71c4e18135a4f044d5b93af0ee3?s=128

wernerkrauss

October 11, 2019
Tweet

Transcript

  1. 2.

    What‘s that? • File system abstraction library for PHP •

    Omnipay for files • Adapter pattern • Your code doesn‘t care if your file is saved locally… • …or on S3, Azure, Dropbox, FTP… • …just talk to the flysystem adapter 11.10.2019 www.silverstrip.es 2
  2. 3.

    History • Developed by Frank de Jonge (thephpleague) • v0.1

    in Oct. 2013 • v1.0 in Jan. 2015 • Currently v1.0.55 • MIT licensed 11.10.2019 www.silverstrip.es 3
  3. 4.

    SilverStripe and Flysystem • SS4 uses Flysystem • Now it‘s

    easier to work with remote files 11.10.2019 www.silverstrip.es 4
  4. 5.

    Some Differences • Versioned Files needs a public and a

    private adapter • Thin wrappers around Flysystem adapters 11.10.2019 www.silverstrip.es 5
  5. 6.

    Adapter anyone? • Local Adapter • S3 Adapter • Many

    Flysystem adapters available • Need modification for SiverStripe‘s public/private files 11.10.2019 www.silverstrip.es 6
  6. 7.

    Configuring • The S3 Adapter only needs some ENV-Vars set:

    – AWS_REGION – AWS_BUCKET_NAME – AWS_ACCESS_KEY_ID* – AWS_SECRET_ACCESS_KEY* – * if outside of an EC2 instance • Injector replaces the local adapter with the S3 adapters 11.10.2019 www.silverstrip.es 7
  7. 8.

    Problems? • One more abstraction layer seems overkill • Updating

    file related code from SS3… • Know your filesystem • Injector is powerful but complicated 11.10.2019 www.silverstrip.es 8
  8. 9.

    Questions! • Multiple Adapters possible? • Save different DataObject relations

    in different file systems? • E.g. put user uploaded files to a dropbox 11.10.2019 www.silverstrip.es 9