Download the PHP package genilto/sbackup without Composer
On this page you can find all versions of the php package genilto/sbackup. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sbackup
SBackup
A small way to generate and send backups to somewhere like onedrive or dropbox using PHP.
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
Adapter to work with dropbox api.
https://github.com/genilto/sbackup-dropbox
SBackup-Onedrive
Adapter to work with onedrive api.
https://github.com/genilto/sbackup-onedrive
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:
It will install all the dependencies you need to work with dropbox, including our SBackup library!
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: https://github.com/genilto/sbackup-example
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:
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:
Now you are ready to run the command bellow:
It will start a docker container, running an apache with php on http://localhost:86. If you see the SBackup Tests! page, you are ready to go ahead.
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:
OBS: To get the Dropbox Client ID and Dropbox Client Secret you can create your APP in https://developer.dropbox.com
Now, you already have available $SBackup object to work with your backups!
Authentication
Next step is to create a page that allows you to authenticate the program to your account in dropbox. For that, you can create a new file inside html folder, called auth.php, with the following content:
If you want to test the authentication right now, you can navigate to http://localhost:86/auth.php
There you must follow the instructions.
Upload
If you have followed all the steps bellow, now you are ready for upload files to dropbox. For that you can create another file named upload.php inside the html folder, with the following content: