A runnable Yii3 demo for uploading documents, extracting readable markdown, summarizing content, and tracking processing progress.
- Upload one or more Markdown, text, HTML, PDF, or DOCX files.
- Validate uploads before processing.
- Store original files and extracted markdown in S3-compatible storage.
- Process documents through
yiisoft/queue. - Show status, progress, summaries, extracted markdown, original downloads, retries, deletion, and a full clear action.
- Run local summaries through the included
llama.cppDocker service, with deterministic mock summaries used for tests or explicit fallback.
- Docker with Docker Compose.
make.
Build and start the demo:
make build
make upBy default, development uses AMQP queue mode, two background workers, Kreuzberg extraction, and local summaries through llama.cpp. Copy .env.example to .env to adjust these settings.
Create the database tables:
make -- yii migrate:up -yOpen the app:
http://127.0.0.1/
Upload up to 20 supported documents at once from the upload box. Each file can be up to 50 MB. The Docker image sets matching PHP upload limits, including a 1024 MB POST body limit. The app shows progress and results in the document table. Use Retry for failed documents, Delete for one document, or Clear all to remove all documents, stored files, database records, and pending queue jobs.
Stop the demo:
make downRun project commands through make so they execute in the configured Docker environment.
Do not call ./yii or composer directly from the host.
Run Composer commands:
make composer installRun Yii console commands:
make yii <command>When passing command options that start with -, use make --:
make -- yii migrate:up -yOpen a shell in the app container:
make shellThe default development queue mode is amqp, so make up starts the app and two background workers.
For immediate in-request processing without workers, use sync mode:
QUEUE_DRIVER=sync make upTo process jobs with the native Yii queue worker:
make yii queue:run
make yii queue:listenTo run AMQP mode:
QUEUE_DRIVER=amqp make upTo run Valkey/Redis mode:
QUEUE_DRIVER=redis make upAny explicit non-sync queue driver starts the native Yii queue worker in the background.
Run multiple background workers by setting WORKERS:
QUEUE_DRIVER=amqp WORKERS=3 make up
QUEUE_DRIVER=redis WORKERS=3 make upDocument processing is wired through yiisoft/queue; there is no demo-specific worker command.
By default, development uses S3-compatible storage through the included Garage container. make up starts Garage, and the app stores document files in the automatically created documents bucket.
Default Garage settings:
DOCUMENT_STORAGE_DRIVER=s3
S3_ENDPOINT=http://garage:3900
S3_REGION=garage
S3_BUCKET=documents
S3_ACCESS_KEY=GKdemo000000000000000000000000000000
S3_SECRET_KEY=garage-demo-secret-key-000000000000000000000000000000
S3_PATH_STYLE=true
To use another S3-compatible service, set the same S3_* variables in docker/dev/override.env, then restart the demo:
make upLocal filesystem storage is available for testing with:
DOCUMENT_STORAGE_DRIVER=localLocal LLM summaries are enabled by default through the OpenAI-compatible llama.cpp adapter:
LLM_ADAPTER=llamacpp
LLAMA_CPP_SERVICE=1
LLM_BASE_URL=http://llama:8080/v1
LLM_MODEL=gemma-3-1b-it-Q4_K_M
LLAMA_CPP_HF_REPO=ggml-org/gemma-3-1b-it-GGUF:Q4_K_MThen start the demo:
make upmake up starts the llama.cpp server profile only when LLM_ADAPTER=llamacpp and LLAMA_CPP_SERVICE=1. The service uses the official ghcr.io/ggml-org/llama.cpp:server image and is available to the app inside Docker at http://llama:8080/v1. The app and queue workers wait for the llama.cpp health endpoint before starting, so uploads do not race the model server on first boot.
The default llama.cpp model is ggml-org/gemma-3-1b-it-GGUF:Q4_K_M. It is the smallest Gemma default that gives usable summaries for this demo while still running on CPU-only hardware.
The default server uses one request slot and a 4096-token context so document summaries do not fail from the tiny model's context being split across parallel slots.
Tests force mock summaries through the test Docker compose file. For deterministic mock summaries in development without the llama.cpp service, set this in .env:
LLM_ADAPTER=mock
LLAMA_CPP_SERVICE=0By default, llama.cpp downloads the configured Hugging Face GGUF repository into a Docker volume. You can also mount a local model by placing a GGUF file under models/ and setting:
LLM_ADAPTER=llamacpp
LLAMA_CPP_SERVICE=1
LLAMA_CPP_HF_REPO=
LLAMA_CPP_MODEL=/models/model.ggufThe application talks to any OpenAI-compatible chat completions endpoint through LLM_BASE_URL, LLM_MODEL, and optional LLM_API_KEY. For an external endpoint, use LLM_ADAPTER=llamacpp and leave LLAMA_CPP_SERVICE=0.
Common environment variables:
QUEUE_DRIVER=sync|amqp|redisWORKERSQUEUE_NAMEAMQP_HOST,AMQP_PORT,AMQP_USER,AMQP_PASSWORD,AMQP_VHOSTREDIS_HOST,REDIS_PORT,REDIS_TIMEOUTDATABASE_DSN=sqlite:/app/runtime/documents.sqliteDOCUMENT_STORAGE_DRIVER=s3|localS3_ENDPOINT,S3_REGION,S3_BUCKET,S3_ACCESS_KEY,S3_SECRET_KEY,S3_PATH_STYLEEXTRACTOR_ADAPTER=kreuzberg|nativeLLM_ADAPTER=mock|llamacppLLM_BASE_URL,LLM_MODEL,LLM_API_KEYLLAMA_CPP_SERVICE=0|1LLAMA_CPP_HF_REPO,LLAMA_CPP_MODEL,LLAMA_CPP_MODEL_URLLLAMA_CPP_CTX_SIZE,LLAMA_CPP_PARALLEL,LLAMA_CPP_N_PREDICT
Run the test suite:
make testRun static analysis:
make psalm
make composer-dependency-analyserIf you need help or have a question, check out Yii Community Resources.
The Yii3 Demo Document Summarizer is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Maintained by Yii Software.
