PHPackages                             genilto/sbackup - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. genilto/sbackup

ActiveLibrary[File &amp; Storage](/categories/file-storage)

genilto/sbackup
===============

A small layer created to abstract the ways to send backups to different cloud services with php.

2.0.3(3y ago)0801MITPHP

Since Dec 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/genilto/sbackup)[ Packagist](https://packagist.org/packages/genilto/sbackup)[ Docs](https://github.com/genilto/sbackup)[ RSS](/packages/genilto-sbackup/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (6)Used By (1)

SBackup
=======

[](#sbackup)

[![SBackup](/assets/logo.png "SBackup")](/assets/logo.png)

A small way to generate and send backups to somewhere like onedrive or dropbox using PHP.

Adapters
--------

[](#adapters)

SBackup does nothing without an adapter. Bellow are the implemented adapers until now. You need to require one of above adapters to be able to use in your project.

SBackup-Dropbox
---------------

[](#sbackup-dropbox)

Adapter to work with dropbox api.

SBackup-Onedrive
----------------

[](#sbackup-onedrive)

Adapter to work with onedrive api.

Install
-------

[](#install)

To use the library you can just import to your project using composer. The very first thing is to create a folder for your project, called **sbackup-example** and then run the composer like below:

```
composer require genilto/sbackup-dropbox
```

It will install all the dependencies you need to work with dropbox, including our SBackup library!

How to use
----------

[](#how-to-use)

Below is a simple example of how you can use the library. Be creative on you own project. If you want, you can clone the examples from repository:

### Test environment

[](#test-environment)

To help us to easily test the application, we can use docker-composer, it's very simple to use and very fast to create an environment using the exactly php version you want.

Just be sure you have docker and docker-compose installed on your system.

Create a file named **docker-compose.yml** with the following content inside your project folder:

```
version:  '3.8'

services:
  apache:
    image: php:8.1-apache
    container_name: apache
    restart: unless-stopped
    ports:
      - 86:80
    environment:
      - DROPBOX_CLIENT_ID=${DROPBOX_CLIENT_ID}
      - DROPBOX_CLIENT_SECRET=${DROPBOX_CLIENT_SECRET}
    volumes:
      - .:/var/www
```

Remember to replace the **${DROPBOX\_CLIENT\_ID}** and **${DROPBOX\_CLIENT\_SECRET}** with your dropbox credentials.

Now create another folder called **html** and inside create a file called **index.php** with the following content:

```
DOCTYPE  html>

SBackup tests!

  SBackup Tests

   1 - Go to Authentication page

   2 - Go to Upload page

```

Now you are ready to run the command bellow:

```
docker-compose up -d
```

It will start a docker container, running an apache with php on . If you see the **SBackup Tests!** page, you are ready to go ahead.

### Base Configuration

[](#base-configuration)

Next step you need to do is to instantiate all the classes that must be injected in SBackup, and then instantiate the SBackup class. Inside the **html** folder, create a file called **backup.config.php** with the following content:

```
