# wpide/3.0/_services.php

WPIDE – File Manager &amp; Code Editor, version 3.0. 142 lines.

- Page: https://pluginprobe.com/plugins/wpide/3.0/code/_services.php
- Raw: https://pluginprobe.com/plugins/wpide/3.0/raw/_services.php
- Modified: 2022-07-30T20:33:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/wpide/3.0/code/_services.php#L10-L20`.

```php
<?php
defined( 'ABSPATH' ) || exit;

use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use WPIDE\App\Services\Storage\LocalFileSystem;

use const WPIDE\Constants\DIR;
use const WPIDE\Constants\SLUG;
use const WPIDE\Constants\TMP_DIR;

return [
    'WPIDE\App\Services\Logger\LoggerInterface' => [
        'handler' => '\WPIDE\App\Services\Logger\Adapters\MonoLogger',
        'config' => [
            'monolog_handlers' => [
                function () {
                    return new \Monolog\Handler\StreamHandler(
                        ini_get('error_log'),
                        \Monolog\Logger::DEBUG
                    );
                },
            ],
        ],
    ],
    'WPIDE\App\Services\Session\SessionStorageInterface' => [
        'handler' => '\WPIDE\App\Services\Session\Adapters\SessionStorage',
        'config' => [
            'name' => SLUG,
            'handler' => function () {
                $save_path = null; // use default system path
                $handler = new NativeFileSessionHandler($save_path);

                return new NativeSessionStorage([
                    "cookie_samesite" => "Lax",
                    "cookie_secure" => null,
                    "cookie_httponly" => true,
                ], $handler);
            },
        ],
    ],
    'WPIDE\App\Services\Cors\Cors' => [
        'handler' => '\WPIDE\App\Services\Cors\Cors',
        'config' => [
            'enabled' => defined('WP_DEBUG') && WP_DEBUG,
        ],
    ],
    'WPIDE\App\Services\Tmpfs\TmpfsInterface' => [
        'handler' => '\WPIDE\App\Services\Tmpfs\Adapters\Tmpfs',
        'config' => [
            'path' => TMP_DIR,
            'gc_probability_perc' => 10,
            'gc_older_than' => 60 * 60 * 24 * 2, // 2 days
        ],
    ],
    'WPIDE\App\Services\Security\Security' => [
        'handler' => '\WPIDE\App\Services\Security\Security',
        'config' => [
            'ip_allowlist' => [],
            'ip_denylist' => []
        ],
    ],
    'WPIDE\App\Services\View\ViewInterface' => [
        'handler' => '\WPIDE\App\Services\View\Adapters\Vuejs',
        'config' => [],
    ],
    'WPIDE\App\Services\Storage\Filesystem' => [
        'handler' => '\WPIDE\App\Services\Storage\Filesystem',
        'config' => LocalFileSystem::getConfig(
            null,
            [
                'dirs' => LocalFileSystem::excludedDirs(),
                'files' => LocalFileSystem::excludedFiles()
            ]
        ),
    ],
//        'WPIDE\App\Services\Storage\Filesystem' => [
//            'handler' => '\WPIDE\App\Services\Storage\Filesystem',
//            'config' => [
//                'separator' => '/',
//                'config' => [],
//                'adapter' => function () {
//                    $client = new \Aws\S3\S3Client([
//                        'credentials' => [
//                            'key' => AWS_ACCESS_KEY,
//                            'secret' => AWS_SECRET_KEY
//                        ],
//                        'region' => 'us-east-1',
//                        'version' => 'latest',
//                    ]);
//
//                    return new \League\Flysystem\AwsS3v3\AwsS3Adapter($client, 'bervana');
//                },
//            ],
//        ],
    'WPIDE\App\Services\Database\Database' => [
        'handler' => '\WPIDE\App\Services\Database\Database',
        'config' => [],
    ],
//    'WPIDE\App\Services\Database\DatabaseApi' => [
//        'handler' => '\WPIDE\App\Services\Database\DatabaseApi',
//        'config' => [
//            'username' => DB_USER,
//            'password' => DB_PASSWORD,
//            'database' => DB_NAME,
//            'address' => DB_HOST
//        ]
//    ],

    'WPIDE\App\Services\Cache\Cache' => [
        'handler' => '\WPIDE\App\Services\Cache\Cache',
        'config' => [
            'group' => SLUG
        ],
    ],
    'WPIDE\App\Services\Transient\Transient' => [
        'handler' => '\WPIDE\App\Services\Transient\Transient',
        'config' => [
            'prefix' => SLUG.'_'
        ],
    ],
    'WPIDE\App\Services\Archiver\ArchiverInterface' => [
        'handler' => '\WPIDE\App\Services\Archiver\Adapters\ZipArchiver',
        'config' => [],
    ],
    'WPIDE\App\Services\Auth\AuthInterface' => [
        'handler' => '\WPIDE\App\Services\Auth\Adapters\WPAuth',
        'config' => [
            'wp_dir' => ABSPATH,
            'permissions' => ['read', 'write', 'upload', 'download', 'batchdownload', 'zip'],
            'private_repos' => false,
        ],
    ],
    'WPIDE\App\Services\Router\Router' => [
        'handler' => '\WPIDE\App\Services\Router\Router',
        'config' => [
            'query_param' => 'req',
            'routes_file' => DIR.'_routes.php',
        ],
    ],
];

```
