Laravel With Tenbyte
How do I use Laravel with Tenbyte?
Laravel is validated for use with Tenbyte. To use this product with Tenbyte, please follow the instructions below.- Set up your Tenbyte account and create a bucket as described here.
- Install Composer using the CLI.
- Create a new Laravel project using the following command. You will receive the following output on the terminal once it is successfully created:

-
Go inside your project using the
cdcommand and you will see the project files inside.
-
Now we will need to edit certain files inside this project to make this work with S3-style storage. You can either use any editor to edit the files (e.g.
vimornano) or make use of an IDE to search and edit them easily (e.g. Atom or Visual Studio Code). -
Once you have the framework open in an IDE, create a new
.phpfile inresources -> viewsand name itfileUpload.blade.php.Note: We recommend using the same name for the test as we have used this name when referencing in other files. The hierarchy would look like this:
Paste the below code infileUpload.blade.php: -
Now go to
routes -> web.phpand replace the file with the following code:Note: The directory here is
my-fileand your files will be uploaded inside it. We are also passingTenbyteas a driver, which we will configure later infilesystems.phpto specify our custom-defined driver to pass user input. -
Go to
vendor -> .envfile and replace with the following code.NOTE: Make sure to use your correct Access Key, Secret Access Key, Tenbyte bucket region, Tenbyte Bucket Name, and Tenbyte Region URL.
Note: This example uses Tenbyte’s
us-east-1storage region. To use other Tenbyte storage regions, please use the appropriate Tenbyte service URL as described in this article. -
Now you need to create a new driver, as S3 has
amazonaws.comhardcoded in the library. Go toconfig -> filesystems.phpand replace with the following code: -
As the Tenbyte/S3 driver is not the default driver for uploading in Laravel, we need a Composer package to make this work. You can get this package on the Laravel website.
Now on the CLI, go inside your Laravel project and run the following two commands:


- Run your code using the following command and the server will start listening on port 8000:

http://127.0.0.1:8000 and you will be prompted to upload files to your Tenbyte bucket. Once submitted, your files will be visible inside the bucket.
