Small PHP app for buying single pixels on a shared 1000×1000 canvas. Each pixel can be reserved, purchased and associated with a link and a short message.
- Quick links
- Prerequisites
- Quickstart (Docker)
- Local (OSPanel / native PHP)
- Running tests
- Security notes
- Developer tips
- Recommended next steps
- API spec: openapi.yaml
- API endpoint: api/pixel.php
- PHP 8 (recommended) or PHP 7.4+
- MySQL
- Docker & Docker Compose (recommended for local development)
- Clone the repository and enter it:
git clone <repo-url>
cd <repo>- Start services:
docker-compose up -d --build- Initialize the database (creates schema and optional seed user):
docker-compose exec php php src/setup_db.php --seed=dev:dev- Open http://localhost:8080 in your browser.
- Place the repo under your webroot (for example
d:\OSPanel\domains\localhost). - Create a database
mainand update DB credentials via environment variables or a local.envfile. - Run the DB setup script:
php src/setup_db.php
# optional: php src/setup_db.php --seed=testuser:testpass- Install PHP dependencies:
composer install- Run unit tests locally:
vendor/bin/phpunit- Integration tests exercise the HTTP endpoints and are intended to run in Docker (CI runs them automatically).
- Do not commit
.envor credentials. Use.env.exampleas a template. - Most DB queries use prepared statements; review any remaining interpolation and convert to prepared queries.
- Sanitize output with
htmlspecialchars()(or use a templating engine) to prevent XSS.
- Use
make testto run the full suite (if your environment has the required tools). - Use
docker-compose exec php bashto run commands inside the PHP container for debugging.
MIT — see LICENSE