This project demonstrates the use of Laravel's Sail environment to execute a command-line utility that generates an Excel report based on user data within a specified date range. The Excel file is then stored in MinIO, simulating AWS S3 storage.
- Command-line Interaction: Trigger the generation of reports using a custom Artisan command.
- Queue Management: Utilize Laravel queues to process jobs asynchronously.
- Excel Generation: Create Excel files dynamically based on provided dates.
- MinIO Storage: Store generated Excel files in MinIO for AWS S3 simulation.
- Docker (for running Laravel Sail)
- Laravel Sail
- MinIO (or an equivalent AWS S3-compatible storage service)
-
Clone the repository:
git clone <repository-url> cd <project-directory>
-
Start the Laravel Sail environment:
./vendor/bin/sail up
-
Install project dependencies:
./vendor/bin/sail composer install
-
Configure your environment variables in
.env
:- Set up database connection.
- Add MinIO configuration:
FILESYSTEM_DISK=s3 AWS_ACCESS_KEY_ID=sail AWS_SECRET_ACCESS_KEY=password AWS_DEFAULT_REGION=us-east-1 AWS_BUCKET=reports AWS_USE_PATH_STYLE_ENDPOINT=true AWS_URL=http://minio:9000/reports AWS_ENDPOINT=http://minio:9000
-
Run migrations to set up the database:
./vendor/bin/sail artisan migrate
-
Run the Command: Use the following Artisan command to generate an Excel report:
./vendor/bin/sail artisan report <start_date> <end_date>
Replace
<start_date>
and<end_date>
with the desired date range inYYYY-MM-DD
format. -
Queue Processing: Ensure the queue worker is running to process the job:
./vendor/bin/sail artisan queue:work
-
Generated File: The Excel file will be saved with a name like
usersreport-<timestamp>.xlsx
in your configured MinIO storage bucket.
- Trigger the command:
./vendor/bin/sail artisan report 2025-01-01 2025-01-15
- The job processes the date range and generates the Excel file.
- The file is stored in MinIO, accessible via your configured bucket.
- MinIO is used to mimic AWS S3 functionality, making it easier to test and develop locally.
Feel free to fork this repository and submit pull requests. Ensure your contributions adhere to the Laravel coding standards.
Enjoy working with this Laravel Sail project and generating reports seamlessly!