Page 1 of 1

Getting ai-filesystem to work

Posted: 11 Dec 2015, 20:18
by swpierce
I'm having trouble getting the ai-filesystem extension to work.

First problem: I can't get it to install using composer. Here's my composer.json file:

Code: Select all

    "prefer-stable": true,
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "aimeos/aimeos-laravel": "~1.0",
        "aimeos/ai-filesystem": "dev-master"
    },
Running composer update to install the filesystem gives me an error:

Code: Select all

  Problem 1
    - The requested package aimeos/ai-filesystem could not be found in any version, there may be a typo in the package name.
So, I went to github and downloaded the Zip for the extension. I unzipped everything so the extension is now in ext/ai-filesystem
I configured this in config/shop.php:

Code: Select all

	'resource' => array(
		'db' => array(
			'adapter' => 'mysql',
			'host' => env('DB_HOST', 'localhost'),
			'port' => env('DB_PORT', ''),
			'database' => env('DB_DATABASE', 'laravel'),
			'username' => env('DB_USERNAME', 'root'),
			'password' => env('DB_PASSWORD', ''),
			'stmt' => array( "SET NAMES 'utf8'", "SET SESSION sql_mode='ANSI'" ),
			'opt-persistent' => 0,
			'limit' => 2,
		),
        'fs' => array(
            'adapter' => 'FlyAwsS3',
            'credentials' => array(
                'key' => env('AWS_KEY'),
                'secret' => env('AWS_SECRET'),
            ),
            'region' => env('AWS_REGION'),
            'version' => 'latest',
            'bucket' => env('AWS_BUCKET'),
            'prefix' => 'webstore',
        ),
),
I know the Amazon S3 stuff in the .env file works because I'm using it in a different part of the web site.

Not that it matters, but config/filesystems.php looks like:

Code: Select all

return [
    'default' => 's3',
    'cloud' => 's3',
    'disks' => [
        'local' => [
            'driver' => 'local',
            'root'   => storage_path('app'),
        ],
        'ftp' => [
            'driver'   => 'ftp',
            'host'     => 'ftp.example.com',
            'username' => 'your-username',
            'password' => 'your-password',
        ],
        's3' => [
            'driver' => 's3',
            'key'    => env('AWS_KEY'),
            'secret' => env('AWS_SECRET'),
            'region' => env('AWS_REGION'),
            'bucket' => env('AWS_BUCKET'),
        ],
];
When I upload media, such as when creating a new product or whatever, everything is still stored locally. What am I doing wrong?

Re: Getting ai-filesystem to work

Posted: 11 Dec 2015, 21:58
by aimeos
The new file system layer is only available for dev-master and the upcoming release.
Then, you only need to configure this for AWS S3:

Code: Select all

'resource => array(
    ...
    'fs' => 's3'
),
where 's3' is the name of the Laravel configuration in "config/filesystems.php::disks"