PHPackages                             amanprojects/phpstart - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. amanprojects/phpstart

ActiveLibrary[CLI &amp; Console](/categories/cli)

amanprojects/phpstart
=====================

PHP project scaffolding CLI — create production-ready PHP structures in one command

1.0.1(1mo ago)24MITPHPPHP &gt;=8.1

Since Apr 12Pushed 1mo agoCompare

[ Source](https://github.com/amanprojects-ops/phpstart)[ Packagist](https://packagist.org/packages/amanprojects/phpstart)[ RSS](/packages/amanprojects-phpstart/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (3)Used By (0)

PHPStart - PHP Project Scaffolding CLI
======================================

[](#phpstart---php-project-scaffolding-cli)

A powerful command-line tool to scaffold production-ready PHP projects in seconds.

Features
--------

[](#features)

- 🚀 Create complete PHP projects with one command
- 📦 Multiple project types: Core PHP, MVC, REST API, Laravel
- 🎨 Beautiful CLI with colored output
- 🔧 Zero dependencies - pure PHP only
- 📝 Complete with routing, database, and MVC structure
- 🔐 Built-in authentication and session management
- 🌐 REST API with CORS and middleware support
- 📚 Comprehensive documentation

Installation
------------

[](#installation)

### Step 1 — Install Composer

[](#step-1--install-composer)

If you don't have Composer installed, get it first.

**Linux / macOS**

```
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
composer --version
```

**Windows**Download and run the installer from After install, verify:

```
composer --version
```

---

### Step 2 — Install PHPStart

[](#step-2--install-phpstart)

#### Option A — Global Installation (Recommended)

[](#option-a--global-installation-recommended)

Installs `phpstart` as a global command available anywhere on your system.

```
composer global require amanprojects/phpstart
```

Then make sure Composer's global bin directory is in your system `PATH`.

**Linux / macOS** — add this to your `~/.bashrc`, `~/.zshrc`, or `~/.profile`:

```
export PATH="$HOME/.composer/vendor/bin:$PATH"
```

Reload your shell:

```
source ~/.bashrc
# or
source ~/.zshrc
```

**Windows** — add this path to your system environment variables:

```
C:\Users\YourName\phpstart

```

Go to: `Control Panel > System > Advanced System Settings > Environment Variables`Edit the `Path` variable and add the line above. Then restart your terminal.

Verify the install:

```
phpstart help
```

---

#### Option B — Local Installation (Per Project)

[](#option-b--local-installation-per-project)

Install inside a specific project only.

```
composer require amanprojects/phpstart
./vendor/bin/phpstart help
```

---

#### Option C — Clone and Install Manually

[](#option-c--clone-and-install-manually)

```
git clone https://github.com/amanprojects-ops/phpstart.git
cd phpstart
composer install
chmod +x bin/phpstart          # Linux/macOS only
php bin/phpstart help
```

To use it globally from a local clone, symlink the binary:

**Linux / macOS**

```
sudo ln -s /full/path/to/phpstart/bin/phpstart /usr/local/bin/phpstart
```

**Windows** — add the `bin/` folder path to your system `Path` environment variable.

---

### Step 3 — Verify Installation

[](#step-3--verify-installation)

```
phpstart
phpstart list
phpstart help
```

You should see the ASCII banner and available commands.

Usage
-----

[](#usage)

### Create a New Project

[](#create-a-new-project)

```
# Core PHP project (default)
phpstart new myapp

# MVC Framework
phpstart new myapp --type=mvc

# REST API
phpstart new myapi --type=api

# Laravel
phpstart new myblog --type=laravel
```

### Available Commands

[](#available-commands)

```
phpstart new      # Create a new project
phpstart list           # List all project types
phpstart help           # Show help information
```

### Options

[](#options)

- `--type=` - Project type (core, mvc, api, laravel)
- `--force` - Overwrite existing directory
- `--no-git` - Skip git initialization
- `--author=` - Set author name

Project Types
-------------

[](#project-types)

### Core PHP

[](#core-php)

Basic PHP project with:

- Simple routing system
- PDO database wrapper
- MVC structure
- Helper functions
- Environment configuration

### MVC Framework

[](#mvc-framework)

Full MVC framework with:

- Advanced routing
- Middleware support
- Authentication system
- Session management
- Request/Response handlers
- View rendering engine

### REST API

[](#rest-api)

RESTful API with:

- JSON responses
- CORS support
- Bearer token authentication
- Rate limiting
- Error handling
- RESTful routing (GET, POST, PUT, DELETE)

### Laravel

[](#laravel)

Laravel framework installation with:

- Automatic setup
- Application key generation
- Post-install instructions for Livewire and Filament

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Composer
- Git (optional, for git initialization)

Examples
--------

[](#examples)

```
# Create a core PHP project
phpstart new mywebsite

# Create an MVC project without git
phpstart new myapp --type=mvc --no-git

# Create an API with custom author
phpstart new myapi --type=api --author="John Doe"

# Force overwrite existing directory
phpstart new myapp --force
```

Environment Setup Guide
-----------------------

[](#environment-setup-guide)

This section covers two things:

1. **System environment** — what your machine needs to run `phpstart`
2. **Project `.env`** — how to configure the app that phpstart generates

---

### Part 1 — System Environment (for phpstart itself)

[](#part-1--system-environment-for-phpstart-itself)

phpstart is a CLI tool. It does not use a `.env` file itself. Instead it relies on your **system PATH** and installed tools.

#### Required: PHP &gt;= 8.1

[](#required-php--81)

Verify your PHP version:

```
php --version
# PHP 8.1.x or higher required
```

If PHP is not installed:

OSInstallWindowsDownload from  or install XAMPPmacOS`brew install php`Ubuntu/Debian`sudo apt install php8.1-cli`CentOS/RHEL`sudo dnf install php`Make sure `php` is available in your terminal PATH:

```
# Windows — add PHP folder to system Path
# e.g. C:\xampp\php  or  C:\php

# Linux/macOS — usually auto-added, verify with:
which php
```

---

#### Required: Composer

[](#required-composer)

Verify Composer is installed:

```
composer --version
# Composer version 2.x.x
```

If not installed:

**Linux / macOS**

```
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
```

**Windows**Download the installer from  and run it.

---

#### Required: Composer Global Bin in PATH

[](#required-composer-global-bin-in-path)

After installing phpstart globally, the `phpstart` command must be reachable from your terminal.

**Linux / macOS** — add to `~/.bashrc` or `~/.zshrc`:

```
export PATH="$HOME/.composer/vendor/bin:$PATH"
```

Reload:

```
source ~/.bashrc
```

**Windows** — add this to your system `Path` environment variable:

```
C:\Users\YourName\AppData\Roaming\Composer\vendor\bin

```

Go to: `Control Panel > System > Advanced System Settings > Environment Variables`Find `Path` under System Variables, click Edit, and add the line above. Restart your terminal after saving.

Verify:

```
phpstart help
```

---

#### Optional: Git

[](#optional-git)

Git is used to auto-initialize a repository after scaffolding. If Git is not installed, phpstart will skip this step with a warning.

```
git --version
```

Install Git:

To skip git init when running phpstart:

```
phpstart new myapp --no-git
```

---

#### Optional: Composer (for --type=laravel)

[](#optional-composer-for---typelaravel)

The `laravel` type runs `composer create-project` internally. Composer must be installed and available in PATH for this to work.

---

### Part 2 — Project .env Setup (for generated projects)

[](#part-2--project-env-setup-for-generated-projects)

Every project scaffolded by phpstart includes a `.env` file at the root. This file holds all environment-specific configuration — database credentials, app name, debug mode, etc.

#### Step 1 — Locate Your .env

[](#step-1--locate-your-env)

After running `phpstart new myapp`, your project root will contain:

```
myapp/
├── .env            ← your local config (auto-generated, gitignored)
├── .env.example    ← template with all keys, empty values (safe to commit)
├── public/
├── src/
└── config/

```

If `.env` is missing, recreate it from the example:

```
cp .env.example .env
```

---

#### Step 2 — Configure All Variables

[](#step-2--configure-all-variables)

Open `.env` and fill in your values:

```
# ─────────────────────────────────────────
# APPLICATION
# ─────────────────────────────────────────

APP_NAME="My App"
# Name of your application.
# Use double quotes if the name contains spaces.

APP_ENV=development
# Options: development | production | testing
# development → full errors shown, debug enabled
# production  → errors hidden, optimized for live server
# testing     → used during automated tests

APP_URL=http://localhost:8000
# Full base URL. No trailing slash.
# Local dev server  → http://localhost:8000
# XAMPP subfolder   → http://localhost/myapp/public
# Live server       → https://yourdomain.com

APP_DEBUG=true
# true  → show detailed error pages (use in development only)
# false → hide errors from users (always use in production)

APP_TIMEZONE=UTC
# PHP timezone for all date/time functions.
# Examples: UTC | Asia/Karachi | Asia/Dhaka | Europe/London | America/New_York
# Full list → https://www.php.net/manual/en/timezones.php

# ─────────────────────────────────────────
# DATABASE
# ─────────────────────────────────────────

DB_CONNECTION=mysql
# Database driver.
# Supported: mysql | pgsql | sqlite

DB_HOST=127.0.0.1
# Database server hostname.
# Use 127.0.0.1 instead of localhost to avoid socket issues on some systems.

DB_PORT=3306
# MySQL / MariaDB → 3306
# PostgreSQL      → 5432
# SQLite          → leave blank (not applicable)

DB_DATABASE=myapp
# The database name. Must exist before connecting.
# Create it first:
#   CREATE DATABASE myapp CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

DB_USERNAME=root
# Database user.
# Use a dedicated non-root user in production.

DB_PASSWORD=
# Database password.
# Leave empty if no password is set (common in local XAMPP/WAMP).
# Wrap in double quotes if it contains special characters:
#   DB_PASSWORD="p@$$w0rd#2024"

DB_CHARSET=utf8mb4
# utf8mb4 supports full Unicode including emojis.
# Only change if your server requires a specific charset.
```

---

#### Step 3 — Environment Profiles

[](#step-3--environment-profiles)

**Local Development (PHP built-in server)**

```
APP_NAME="My App"
APP_ENV=development
APP_URL=http://localhost:8000
APP_DEBUG=true
APP_TIMEZONE=UTC

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=
DB_CHARSET=utf8mb4
```

**XAMPP / WAMP (subfolder)**

```
APP_NAME="My App"
APP_ENV=development
APP_URL=http://localhost/myapp/public
APP_DEBUG=true
APP_TIMEZONE=UTC

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=
DB_CHARSET=utf8mb4
```

**Production Server**

```
APP_NAME="My App"
APP_ENV=production
APP_URL=https://yourdomain.com
APP_DEBUG=false
APP_TIMEZONE=Asia/Karachi

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=prod_myapp
DB_USERNAME=db_user
DB_PASSWORD="StrongPassword@2024"
DB_CHARSET=utf8mb4
```

---

#### Step 4 — Reading Variables in Code

[](#step-4--reading-variables-in-code)

Use the built-in `env()` helper anywhere in your project:

```
// Simple read
$name = env('APP_NAME');

// With fallback default
$host = env('DB_HOST', 'localhost');
$port = env('DB_PORT', '3306');

// Boolean check
$debug = env('APP_DEBUG', 'false') === 'true';

// Inside a class
class Database
{
    public function connect(): PDO
    {
        $dsn = sprintf(
            '%s:host=%s;port=%s;dbname=%s;charset=%s',
            env('DB_CONNECTION', 'mysql'),
            env('DB_HOST', '127.0.0.1'),
            env('DB_PORT', '3306'),
            env('DB_DATABASE', ''),
            env('DB_CHARSET', 'utf8mb4')
        );

        return new PDO($dsn, env('DB_USERNAME'), env('DB_PASSWORD'));
    }
}
```

---

#### Step 5 — Common Issues and Fixes

[](#step-5--common-issues-and-fixes)

**`env()` returns null for every key**Your `.env` file is missing or in the wrong location. It must be at the project root, not inside `public/`.

```
myapp/
├── .env        ← correct location
└── public/
    └── index.php

```

**Special characters in password break the connection**Wrap the value in double quotes:

```
DB_PASSWORD="p@$$w0rd#special!"
```

**App name with spaces not loading correctly**Always quote values that contain spaces:

```
APP_NAME="My Awesome App"
```

**Wrong timezone causing date issues**Check your current system timezone:

```
php -r "echo date_default_timezone_get();"
```

Then set the matching value in `.env`.

**Database connection refused**

- Make sure your database server is running
- Try `127.0.0.1` instead of `localhost`
- Verify the database exists and the user has access

**`phpstart` command not found after global install**Your Composer global bin is not in PATH. See Part 1 above.

---

#### .env Security Checklist

[](#env-security-checklist)

RuleWhyNever commit `.env` to gitContains passwords and secretsAlways commit `.env.example`Lets teammates know what keys existSet `APP_DEBUG=false` in productionPrevents leaking stack traces publiclyUse a non-root database user in productionLimits damage if credentials are exposedSet file permissions on Linux: `chmod 600 .env`Prevents other system users from reading itNever place `.env` inside `public/`It would be directly downloadable via browser---

Running Your Project
--------------------

[](#running-your-project)

After creating a project and configuring `.env`:

```
cd myproject
php -S localhost:8000 -t public
```

Visit

Project Structure
-----------------

[](#project-structure)

```
myproject/
├── public/          # Web root
├── src/             # Application code
│   ├── Controllers/ # Controllers
│   ├── Models/      # Models
│   ├── Views/       # Views
│   └── Helpers/     # Helper functions
├── config/          # Configuration files
├── storage/         # Logs, cache, uploads
└── assets/          # CSS, JS, images

```

License
-------

[](#license)

MIT License - see LICENSE file for details

Author
------

[](#author)

Aman Projects

- Email:
- GitHub:

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request.

Support
-------

[](#support)

For issues and questions, please open an issue on GitHub.

---

Made with ❤️ by Aman Projects

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance89

Actively maintained with recent releases

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

58d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae48a428e1ee0b9da2103ff75072d857bbbd658dda0b357835978616e5d8fc4e?d=identicon)[amanprojects](/maintainers/amanprojects)

---

Top Contributors

[![amanprojects-ops](https://avatars.githubusercontent.com/u/172597102?v=4)](https://github.com/amanprojects-ops "amanprojects-ops (4 commits)")

### Embed Badge

![Health badge](/badges/amanprojects-phpstart/health.svg)

```
[![Health](https://phpackages.com/badges/amanprojects-phpstart/health.svg)](https://phpackages.com/packages/amanprojects-phpstart)
```

###  Alternatives

[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24726.4M22](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

13045.3M6.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

596920.8k12](/packages/php-tui-php-tui)[styleci/cli

The CLI tool for StyleCI

70464.1k9](/packages/styleci-cli)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
