PHP code example of whc-projects / flysystem-pdo-adapter

1. Go to this page and download the library: Download whc-projects/flysystem-pdo-adapter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

whc-projects / flysystem-pdo-adapter example snippets


// http://php.net/manual/pl/ref.pdo-mysql.connection.php
$pdo = new PDO('mysql:host=hostname;dbname=database_name', 'username', 'password');
$adapter = new PDOAdapter($pdo, 'files');

// http://php.net/manual/pl/ref.pdo-sqlite.connection.php
$pdo = new PDO('sqlite:/absolute/path/to/database.sqlite');
$adapter = new PDOAdapter($pdo, 'files');

// http://php.net/manual/pl/ref.pdo-pgsql.php
$pdo = new PDO('pgsql:host=localhost;port=5432;dbname=testdb;user=bruce;password=mypass');
$adapter = new PDOAdapter($pdo, 'public.files');

$filesystem = new Filesystem($adapter);