Drive Laravel is a cloud storage application that allows users to upload, store, and manage files and folders online, similar to Google Drive. It provides a web-based interface for managing documents, images, and other files, with built-in features for file organization, activity tracking, and localization support.
- Cloud File Storage: Securely upload and store files in the cloud.
- Folder Structure: Organize files in folders to keep content structured.
- Activity Logging: Track user actions using Laravel Activity Log.
- Localization: Support for multiple languages with automatic string export (via Laravel Translatable String Exporter).
- File Compression: Compress files into ZIP archives (via Laravel ZipStream).
- Testing: Comprehensive tests powered by Pest PHP.
- PHP 8.2 or higher
- Composer
- Node.js and pnpm (for front-end assets)
- Laravel Sail (for Docker-based development environment)
git clone https://github.com/MSIBDiskominfo-pswrn/Drive_Laravel
cd Drive_Laravel
Run the following Composer command to install the PHP dependencies:
composer install
Copy the .env.example
file to .env
:
cp .env.example .env
Generate the application key:
php artisan key:generate
Configure your database connection in the .env
file, for example:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=drive_laravel
DB_USERNAME=root
DB_PASSWORD=your_password_here
and then run migrations:
php artisan migrate
Run the following pnpm command to install front-end dependencies:
pnpm install
You can use Laravel Sail (Docker) to run the application locally. To start the Sail container, use:
./vendor/bin/sail up -d
Visit the following URLs:
- App:
http://localhost
- phpMyAdmin:
http://localhost:8080
- Mailpit:
http://localhost:8025
Alternatively, without Sail, run the app using:
php artisan serve
And access it at: http://localhost:8000
.
To run the front-end development server (which uses Vite) with Sail:
./vendor/bin/sail pnpm dev
Alternatively, if you're not using Sail, you can run the front-end development server with:
pnpm dev
This will start the Vite development server at http://localhost:5173
.
For email handling during development, we use Mailpit, a lightweight email testing tool. It's configured in the .env file, and you should ensure that the following environment variables are set:
MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="no-reply@example.com"
MAIL_FROM_NAME="${APP_NAME}"
- MAIL_MAILER: Set to smtp to use the SMTP protocol.
- MAIL_HOST: Set to mailpit, which corresponds to the Mailpit container in the Sail environment.
- MAIL_PORT: Set to 1025, the default SMTP port for Mailpit.
- MAIL_USERNAME & MAIL_PASSWORD: Set to null as Mailpit doesn't require authentication for local development.
- MAIL_ENCRYPTION: Set to null as encryption is not used in the local development environment.
- MAIL_FROM_ADDRESS: Specify the email address used as the sender's email in your app.
- MAIL_FROM_NAME: This should use the application's name (set via APP_NAME).
Once the environment is set up, you can access Mailpit's web interface at http://localhost:8025
to view and test emails sent by the application.
The TOTAL_STORAGE
environment variable defines the total amount of available global storage for the Drive Laravel application. This value is used to track the total number of bytes allocated for file storage within the system.
To set the TOTAL_STORAGE
variable, add the following line to your .env
file:
TOTAL_STORAGE=10737418240
This example sets the total storage to 10 GB (10737418240 bytes). You can adjust this value according to your storage needs.
If you want to set 1 TB of storage:
TOTAL_STORAGE=1099511627776
Make sure that this value is in bytes.
We use Pest PHP for testing in this project. To run the tests with Sail:
./vendor/bin/sail pest
Alternatively, if you're not using Sail, you can run the test with:
php artisan test
This project uses Prettier for code formatting. To check the formatting with Sail:
./vendor/bin/sail pnpm format:check
To automatically format your code:
./vendor/bin/sail pnpm format
Alternatively, if you're not using Sail, you can check the formatting with:
pnpm format:check
To automatically format your code:
pnpm format
To generate lang translation with Sail:
./vendor/bin/sail artisan translatable:export id
Without Sail, use:
php artisan translatable:export id
For deployment, ensure your server meets the following requirements:
- PHP 8.2+
- Composer
- Node.js for asset compilation
- Proper file system permissions for file uploads
Run migrations on the production environment with Sail:
./vendor/bin/sail artisan migrate
Then, compile front-end assets:
./vendor/bin/sail pnpm build
Cache the route:
./vendor/bin/sail artisan route:cache
Without Sail, use the following commands:
php artisan migrate
pnpm build
php artisan route:cache
To run scheduled tasks, set up a cron job to run once a day at midnight:
- Edit the cron file:
crontab -e
- Add the following line:
0 0 * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
- Save and exit.
The following packages are used in this project:
- Laravel Activity Log: To log user activity.
- Laravel ZipStream: To create downloadable zip files.
- Laravel Sail: To run the application in a Docker-based environment.
- Pest PHP: For testing.
- Prettier and Laravel Pint: For code formatting.
We welcome contributions to the Drive Laravel project! To contribute, follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature/your-feature
). - Make your changes and commit them (
git commit -m 'Add new feature'
). - Push to your branch (
git push origin feature/your-feature
). - Open a pull request.
Please make sure to follow the coding standards and write tests for any new functionality.
This project is licensed under the MIT License - see the LICENSE file for details.