Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working example #6

Closed
tnmendex opened this issue Jan 20, 2016 · 7 comments
Closed

Working example #6

tnmendex opened this issue Jan 20, 2016 · 7 comments

Comments

@tnmendex
Copy link

Exist any public working example of this plugin?
I am trying to understand how to put this working with amazon S3

thank you

@WyriHaximus
Copy link
Owner

I've posted a example config in #5, any specific questions you might have? In a nutshell this plugin is a config wrapper around flysystem

@tnmendex
Copy link
Author

already had the things working but i was having bad time in the begin.

But i like to leave my example, how i let the things working...to help other users maybe you can put this in the initial page

in config/app.php
'AmazonKey' => [
'credentials' => [
'key' => '....',
'secret' => '.....',
],
'region' => 'eu-west-1',
'version' => 'latest',
]

CONTROLLER
use Aws\S3\S3Client;
use League\Flysystem\AwsS3v3\AwsS3Adapter;
use League\Flysystem\Filesystem;
use Cake\Filesystem\File;

$client = S3Client::factory(Configure::read("AmazonKey"));
$adapter = new AwsS3Adapter($client, 'zarcophotos');
$filesystem = new Filesystem($adapter);

$filesystem->put("text.txt","example");
echo $adapter->listContents();

@WyriHaximus
Copy link
Owner

Good idea, I'll add some more examples to the readme and create an examples directory with several examples

@thumbtech
Copy link

thumbtech commented Oct 12, 2017

I just don't get what this plug in does. The example from tnmendex makes no use of the plugin that I can see.

In the readme usage I see:

$this->filesystem('s3_thumbnails')->listContents();

But what is $this referring to?

I tested in Shell (using every namespace I could think of) but was not surprised when it said filesystem function did not exist (even though the plugin is loaded) ...

BTW it is no problem using the Flysystem stuff directly ... what does the plugin bring to the table?

@Spriz
Copy link
Contributor

Spriz commented Oct 13, 2017

@thumbtech you need to use the FileSystemsTrait before you can use $this->filesystem! ;-)

Psst: https://github.com/WyriHaximus/FlyPie/blob/master/src/FilesystemsTrait.php

If you re-read this part https://github.com/WyriHaximus/FlyPie#usage I'm sure you'll get it! 🎉 Otherwise I'll happily help!

@WyriHaximus
Copy link
Owner

@thumbtech the plugin mainly brings some syntactic sugar, configuration structure, and ease of use to the mix .

@thumbtech
Copy link

Thank you @Spriz & @WyriHaximus . I did get it working, although it required a hack & I submitted an issue. I would contribute to docs & fix, but I'm really not sure it is worth maintaining as the interface to FlyPie is very simple without the plug-in ... ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants