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.
- Clone the repository
git clone <repo-url> laravel-pdf-generator
cd laravel-pdf-generator- Install PHP dependencies
composer install- Copy the environment file and set values
cp .env.example .env
# On Windows (PowerShell): Copy-Item .env.example .env- Serve the application
php artisan serve Open your browser at: http://127.0.0.1:8000
Run the test suite with:
php artisan testThis 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.)
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.shThe 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 --authenticatedYou can override the defaults with options such as --project, --region, --repository, --service, and --tag.
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-productionYou can also specify the environment directly with ./deploy.sh --environment develop
or ./deploy.sh --environment production. All other script options remain available.
- If
composer installfails 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 thestoragepublic 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-
PDF generation uses
barryvdh/laravel-dompdf(already included incomposer.json). Checkresources/views/pdf/for example templates. -
Routes and controllers are located in
app/Http/Controllersand views are inresources/views.
Contributions are welcome — please open an issue or a pull request.
The Laravel framework is open-sourced software licensed under the MIT license.