Skip to content

Repository files navigation

Laravel PDF Generator ✅

A lightweight Laravel project that demonstrates PDF generation (using packages like barryvdh/laravel-dompdf) and includes a simple web UI. This README explains how to get the project running locally and in Docker.


🚀 Quick Start

  1. Clone the repository
git clone <repo-url> laravel-pdf-generator
cd laravel-pdf-generator
  1. Install PHP dependencies
composer install
  1. Copy the environment file and set values
cp .env.example .env
# On Windows (PowerShell): Copy-Item .env.example .env
  1. Serve the application
php artisan serve 

Open your browser at: http://127.0.0.1:8000


🧪 Tests

Run the test suite with:

php artisan test

🐳 Docker (optional)

This repository contains a Dockerfile. A simple way to build and run the image locally:

docker build -t laravel-pdf-generator .
docker run -it --rm -p 8000:8000 \
  -e APP_ENV=local -e APP_KEY="base64:..." \
  laravel-pdf-generator

(Adjust environment variables and entrypoint as required; for production deployments prefer using a multi-stage build or Docker Compose.)

☁️ Deploy to Cloud Run

Prerequisites: install and authenticate gcloud and Docker, select a Google Cloud project, and grant your account permissions for Artifact Registry and Cloud Run.

gcloud auth login
gcloud config set project YOUR_PROJECT_ID
chmod +x deploy.sh
./deploy.sh

The script enables the required APIs, uses the containers Docker repository in Artifact Registry, builds and pushes the image, and deploys it to Cloud Run. The default region is us-central1 and the default service is laravel-pdf-generator.

To require authentication, use:

./deploy.sh --authenticated

You can override the defaults with options such as --project, --region, --repository, --service, and --tag.

Deploy by environment

Configure the Google Cloud projects and use the commands below:

export DEVELOP_PROJECT_ID=YOUR_DEVELOP_PROJECT_ID
export PRODUCTION_PROJECT_ID=YOUR_PRODUCTION_PROJECT_ID

npm run deploy-develop
npm run deploy-production

You can also specify the environment directly with ./deploy.sh --environment develop or ./deploy.sh --environment production. All other script options remain available.


⚠️ Troubleshooting & Tips

  • If composer install fails with memory errors, run:
COMPOSER_MEMORY_LIMIT=-1 composer install
  • Ensure PHP extensions required by Laravel are installed (openssl, pdo, mbstring, tokenizer, xml, ctype, json, bcmath).

  • On Windows, if symlinks fail for php artisan storage:link, create the storage public folder manually or run your terminal as Administrator.

  • If assets are not updating, try:

npm run dev
php artisan view:clear
php artisan route:clear
php artisan config:clear

📁 Project notes

  • PDF generation uses barryvdh/laravel-dompdf (already included in composer.json). Check resources/views/pdf/ for example templates.

  • Routes and controllers are located in app/Http/Controllers and views are in resources/views.


🤝 Contributing

Contributions are welcome — please open an issue or a pull request.


📜 License

The Laravel framework is open-sourced software licensed under the MIT license.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages