FREE & OPEN SOURCE
PHP Scripts
Free Invoice Generator PHP Script
InvoiceZip: clients, invoices with line items, tax, share-by-link, printable PDF view and a revenue dashboard. SQLite — zero database setup.
What it is
InvoiceZip is a self-hosted invoicing app with a mini CRM, and the first multi-file, database-backed build in this series. You manage clients, create invoices with line items, tax and discounts, and track their lifecycle: draft, sent, paid — with overdue computed automatically from the due date.
Every invoice gets a private share link: your client opens it in the browser with no login, sees a clean invoice sheet, and prints it or saves it as a PDF straight from the browser. The dashboard shows outstanding and paid totals, an SVG revenue chart of the last 6 months, and your recent invoices. Everything exports to CSV for your accountant.
Storage is a single SQLite file that creates itself on first run — no MySQL to configure, nothing to migrate. 14 small PHP files plus one stylesheet, readable in one sitting. No framework, no Composer, no build step, no tracking.
Every invoice gets a private share link: your client opens it in the browser with no login, sees a clean invoice sheet, and prints it or saves it as a PDF straight from the browser. The dashboard shows outstanding and paid totals, an SVG revenue chart of the last 6 months, and your recent invoices. Everything exports to CSV for your accountant.
Storage is a single SQLite file that creates itself on first run — no MySQL to configure, nothing to migrate. 14 small PHP files plus one stylesheet, readable in one sitting. No framework, no Composer, no build step, no tracking.
Server requirements & dependencies
- PHP 8.1 or newer with pdo_sqlite (enabled by default on almost every host, including shared hosting)
- Any web server: Apache, Nginx, LiteSpeed, or PHP's built-in server for local use
- ~200 KB of disk to start; the SQLite database file grows with your data
- No MySQL, no Composer, no Node/build step, no external services or APIs
- Works in any folder: domain root, a subfolder like /invoicezip/, or a subdomain
How to install
1. Unzip and upload the invoicezip/ folder to your server (e.g. yoursite.com/invoicezip/).
2. Open it in your browser. On first run it asks you to choose an admin password and prints a ready-made ADMIN_PASSWORD_HASH line — paste that line into inc/config.php. That's the whole setup.
3. Log in, enter your company details under Settings (name, address, currency, tax rate, invoice numbering), add your first client, and create an invoice. Send your client the share link from the invoice page — they can view and print it without any login.
The data/ folder (SQLite database) is created automatically with an Apache deny rule inside. On Nginx, add: location ~ /invoicezip/data/ { deny all; }
2. Open it in your browser. On first run it asks you to choose an admin password and prints a ready-made ADMIN_PASSWORD_HASH line — paste that line into inc/config.php. That's the whole setup.
3. Log in, enter your company details under Settings (name, address, currency, tax rate, invoice numbering), add your first client, and create an invoice. Send your client the share link from the invoice page — they can view and print it without any login.
The data/ folder (SQLite database) is created automatically with an Apache deny rule inside. On Nginx, add: location ~ /invoicezip/data/ { deny all; }
The prompt — build it yourself
Paste this into Claude and you'll get this product. This is the actual spec that produced the code above.
Paste this prompt into Claude to build this exact product:
What happened when we ran it: Claude produced the full 15-file app in one pass — 1,148 lines. One revision was needed: the SQLite schema used
Note: the download on this page ships with
Build a complete, production-quality PHP application called InvoiceZip: a self-hosted invoice generator with a mini CRM. Unlike a toy script, structure it as a small multi-file app: anindex.phpfront controller, aninc/folder (config, helpers, db, auth, layout) and apages/folder (one file per screen), plus one stylesheet. No framework, no Composer.
Data model (SQLite via PDO, file self-creates on first run):settings(key/value: company name, address, billing email, default currency + tax rate, invoice number prefix and next number),clients(name, company, email, address, notes),invoices(client_id, unique number, status draft/sent/paid, issue & due dates, currency, tax rate %, discount amount, notes, unique share token, paid_at),items(invoice_id, description, qty, unit price, position). Foreign keys ON, WAL mode. The data folder must self-create with a deny-all .htaccess inside.
Screens: Dashboard (KPIs: outstanding, paid this month, overdue count, client count; inline SVG bar chart of paid revenue for the last 6 months; recent invoices). Invoices list with status filter chips and CSV export. Invoice editor with dynamic line-item rows (vanilla JS add/remove). Internal invoice view with totals, status buttons and the share link. Clients page (list + add/edit/delete in one screen). Settings page.
Public share view:?p=pub&t=TOKENrenders a clean printable invoice sheet for the client — no login,@media printstyles, a "Print / save as PDF" button, 404 on a wrong token.
Business rules: totals are always computed from items (subtotal → discount → tax → total, discount capped at subtotal); a *sent* invoice past its due date displays as overdue automatically; marking paid stamps paid_at; invoice numbers come from the prefix + auto-incrementing counter in settings.
Security & auth: single admin password as apassword_hashconstant in config; if the constant is empty, the login page becomes a first-run hash generator that prints the config line to paste. CSRF token on every form,sleep(1)on failed login, session_regenerate_id on success, all output escaped, all SQL via prepared statements.
Demo mode: a DEMO_MODE constant that makes the whole app browsable without login but blocks every write with a friendly flash message, and seeds realistic sample data (a few clients, ~8 invoices across 6 months with mixed statuses) on first run.Design: one hand-written stylesheet, CSS custom properties, automatic dark mode via prefers-color-scheme, violet accent, rounded cards, no CSS framework. Include a small inline SVG logo used in the nav.Deliver all files with their paths. Target PHP 8.1+, strict types in the entry point, MIT license.
What happened when we ran it: Claude produced the full 15-file app in one pass — 1,148 lines. One revision was needed: the SQLite schema used
datetime("now") as a column default, which SQLite rejects as non-constant; switching to CURRENT_TIMESTAMP fixed it. Everything else — first-run hash generator, login, client & invoice CRUD, computed totals (verified by hand: subtotal 825 − 50 discount + 19% tax = 922.25), status flow, public token view, CSV export and demo write-blocking — passed functional tests on the first attempt.Note: the download on this page ships with
DEMO_MODE = false — no demo restrictions. The prompt is for reproducing (or remixing) the build yourself with your own Claude subscription. Reviews
Used Free Invoice Generator PHP Script? A star rating takes two seconds and helps others.
More builds
Free Chevereto Alternative — Self-Hosted Image Hosting PHP Script (PixelZip)
Free Slingshot Castle Demolition Game — Single HTML File (Castle Breaker 2D)
Free Vampire Survivors-Style Game — Single HTML File (Neon Swarm Survivor)
Free Suika-Style Planet Merge Game — Single HTML File (Cosmic Merge 2D)
License: MIT — free for personal and commercial use, no warranty. Software is provided as is; review the code before running it in production (it's short enough to actually read).