/oracle-storage

Lib for Oracle Cloud Storage use in php or Laravel

Primary LanguagePHPMIT LicenseMIT

Oracle Storage

Build Status

A service made to provide, set up your application to connect Oracle cloud storage.

Installing

  • Add this line to require section of composer require "tray-labs/oracle-storage"

  • If do you use php make like this:

  • Make a config file like this:

<?php
return [
    'user' => [
        'username' => 'your@email.com',
        'password' => 'yourPassword'
    ],
    'account' => [
        'identifier' => 'yourIdentifierStorage',
        'auth_uri' => 'yourAuthUri',
    ],
    'storage' => [
        'container' => 'yourContainer',
        'local_path' => 'localWhereDoYouSaveTheFile',
        'cache' => true
    ]
];
  • Or if do you use laravel make like this:

  • Add this lines to yours config/app.php

'providers' => [
    TrayLabs\OracleStorage\Providers\ServiceProvider::class,
]
'aliases' => [
    'OracleStorage' => TrayLabs\OracleStorage\Facades\OracleStorage::class,
]
  • Define in the .env files the following variables to connect to OracleStorage
ORACLE_STORAGE_USERNAME=your@email.com
ORACLE_STORAGE_PASSWORD=yourPassword
ORACLE_STORAGE_IDENTIFIER=yourStorageIdentifier
ORACLE_STORAGE_AUTH_URI=yourAuthUri
ORACLE_STORAGE_CONTAINER=yourContainer
ORACLE_STORAGE_LOCAL_PATH=localWhereDoYouSaveTheFile
  • Write this into your terminal inside your project
php artisan vendor:publish

Upload

  • In php:
<?php

use \TrayLabs\OracleStorage\OracleStorage;
use \TrayLabs\OracleStorage\Object\File;
use \TrayLabs\OracleStorage\Exception\FileNotFound;

$client = new OracleStorage(require 'yourConfigFile.php');
// execute upload your file
$fileName = $client->upload('fileName', new File($yourFile));
  • In Laravel:
<?php
 use TrayLabs\OracleStorage\Facades\OracleStorage;

// execute upload your file 
 $fileName = OracleStorage::upload('fileName', new File($yourFile));

Download

<?php

use \TrayLabs\OracleStorage\OracleStorage;
use \TrayLabs\OracleStorage\Object\File;
use \TrayLabs\OracleStorage\Exception\FileNotFound;

$client = new OracleStorage(require 'yourConfigFile.php');
// execute download your file
$client->download('fileName');
  • In Laravel:
<?php
 use TrayLabs\OracleStorage\Facades\OracleStorage;
 
 // execute download your file
 OracleStorage::download('fileName');

Delete

  • In php:
<?php

use \TrayLabs\OracleStorage\OracleStorage;
use \TrayLabs\OracleStorage\Object\File;
use \TrayLabs\OracleStorage\Exception\FileNotFound;

$client = new OracleStorage(require 'yourConfigFile.php');
// execute delete your file
$client->delete('fileName');
  • In Laravel:
 <?php
 use TrayLabs\OracleStorage\Facades\OracleStorage;

// execute delete your file 
 OracleStorage::delete('fileName');

Metadata

  • In php:
<?php

use \TrayLabs\OracleStorage\OracleStorage;
use \TrayLabs\OracleStorage\Object\File;
use \TrayLabs\OracleStorage\Exception\FileNotFound;

$client = new OracleStorage(require 'yourConfigFile.php');
// get information about your file
$client->metadata('fileName');
  • In Laravel:
 <?php
 use TrayLabs\OracleStorage\Facades\OracleStorage;
 
 // get information about your file
 OracleStorage::metadata('fileName');

License

This project is licensed under the MIT License