Skip to content
/ php_starter_kit Public template

Batteries included docker template for building PHP applications

License

Notifications You must be signed in to change notification settings

rdurica/php_starter_kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Starter Kit

PHP Docker composer

php8

"PHP Starter Kit" is a blank preconfigured docker template for building PHP applications.

Overview

This PHP Starter Kit provides a ready-to-use, out-of-the-box local development environment for modern PHP projects. It comes preconfigured with everything you need to start coding immediately, without wasting time on setup and configuration. The starter kit is built on the latest stable PHP version and includes all essential PHP extensions, a minimal and efficient Docker image, plus integrated support for popular PHP frameworks.

Key aspects of the starter kit:

  • Docker image based on the latest php-fpm-alpine with NGINX using UNIX sockets for high performance.
  • Minimal production image size (~65 MB) while including all necessary tools and extensions.
  • Dedicated Docker network for local development.
  • Automatic SSL (HTTP/2) support with easy self-signed certificate generation.
  • Makefile included for simple container lifecycle management (init, rebuild, up, down, logs, etc.).
  • Node.js + npm included for frontend tooling and development (Vite, asset bundling).
  • Designed for maximum flexibility and ease use.
  • Enables hot reloading and smooth frontend-backend integration out of the box.

Supported Frameworks

This starter kit is ready to use out of the box with popular PHP frameworks such as Laravel, Symfony, and Nette.

Laravel Symfony Nette

HTTPS and SSL Certificates

For local HTTPS development, it is required to have mkcert installed. This tool helps you generate trusted self-signed certificates.

mkcert -install

Getting Started

  1. Build the Docker image & generate ssl certificates: make init
  2. Access the application in your browser at https://localhost

After initial instalation you can use these commands:

  • make rebuild: Rebuild the Docker image (--pull --no-cache)
  • make reload: Rebuild the Docker image(with cache).
  • make up: Start the containers in detached mode (docker-compose up -d)
  • make down: DStop and remove containers
  • make logs: Show logs from all containers
  • make php: Open a shell inside the PHP container
  • make node: Open a shell inside the Node.js container
  • make node-sync: Synchronize node_modules from container to a root system.
  • make manifest app_name=<$name>: Generate example manifest for k8s. (for example make manifest app_name=app1).

Additional configuration & setup

LaravelLaravel

in vite.config.js add a server section.

import fs from 'fs';

export default defineConfig({
    server: {
        https: {
            key: fs.readFileSync('/etc/nginx/certs/tls.key'),
            cert: fs.readFileSync('/etc/nginx/certs/tls.crt'),
        },
        host: '0.0.0.0',
        port: 5173,
        origin: 'https://localhost:5173',
        cors: {
            origin: 'https://localhost',
            credentials: true,
        }
    }
});

If you’re starting a new Laravel project, simply enter the php container and run the official Laravel interactive installer:

make php
laravel

SymfonySymfony

If you’re starting a new Symfony project, simply enter the php container and run initialize new project in current directory:

make php
symfony new . --webapp --no-git

LaravelNette

If you’re starting a new Nette project, simply enter the php container and run initialize new project:

make php
nette

You need to change the default document root from public/ to www/. Before building the containers, update the NGINX configuration in build/dev/nginx/default.conf:

server {
# /app/src/public -> /app/src/www
root        /app/src/www ;

location ~ \.php$ {
    # /app/src/public -> /app/src/www
    fastcgi_param        SCRIPT_FILENAME /app/src/www$fastcgi_script_name ;
}

Note: If you have already initialized the containers, after making changes you can simply run:

make reload

Contributing

If you would like to contribute to this project, please fork the repository and create a pull request. We welcome all contributions, including bug fixes, new features, and documentation improvements.

License

This project is licensed under the terms of the MIT license.

About

Batteries included docker template for building PHP applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published