PHPackages                             ahmedessam/microservice-installer - 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. ahmedessam/microservice-installer

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

ahmedessam/microservice-installer
=================================

An advanced CLI tool to create and manage Laravel microservices from a template repository

v1.0.0(5mo ago)01MITPHPPHP ^8.2

Since Nov 14Pushed 5mo agoCompare

[ Source](https://github.com/aahmedessam30/microservice-installer)[ Packagist](https://packagist.org/packages/ahmedessam/microservice-installer)[ Docs](https://github.com/aahmedessam30/microservice-installer)[ RSS](/packages/ahmedessam-microservice-installer/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Laravel Microservice Installer
==============================

[](#laravel-microservice-installer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/144a67e1cc984e623b72c5af9bbe6555d41a309e59a12ed3dec417c8d7f280e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61686d6564657373616d2f6d6963726f736572766963652d696e7374616c6c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aahmedessam30/microservice-installer)[![Total Downloads](https://camo.githubusercontent.com/db404cb24d3e630461bd68af14787109bbc6bee7090a987c3dfe7834a71ace2a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61686d6564657373616d2f6d6963726f736572766963652d696e7374616c6c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aahmedessam30/microservice-installer)[![License](https://camo.githubusercontent.com/64add79b887f4a5417b6bb5ded0b4593ea59389527b823d4f192d0f2b9e630d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f61686d6564657373616d2f6d6963726f736572766963652d696e7374616c6c65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/aahmedessam30/microservice-installer)

An advanced, professional CLI tool to create Laravel microservices from the [laravel-microservice-template](https://github.com/aahmedessam30/laravel-microservice-template) repository.

Similar to Laravel/Symfony CLI with interactive wizards, dry-run mode, system diagnostics, and service management features.

Features
--------

[](#features)

### Core Features (V1)

[](#core-features-v1)

- ✅ **PSR-4 Compliant** - Clean, professional code structure
- ✅ **Single Command** - Create a complete microservice instantly
- ✅ **Automatic Configuration** - Updates all service-specific files
- ✅ **Docker Ready** - Configures docker-compose.yml with unique ports
- ✅ **JWT Keys** - Generates RSA key pairs automatically
- ✅ **No Temp Folders** - Creates services in your current directory
- ✅ **Clean Architecture** - Small, focused classes with single responsibilities

### Advanced Features (V2)

[](#advanced-features-v2)

- ✨ **Interactive Mode** - Smart wizard when service name is omitted
- ✨ **Verbose Mode** - Detailed output with `-v` flag
- ✨ **Dry Run** - Preview changes before creating files
- ✨ **Auto Port Detection** - Automatically finds available ports
- ✨ **User Config** - Personal preferences in `~/.microservice-config`
- ✨ **Doctor Command** - System health checks and diagnostics
- ✨ **List Services** - View all services with status and ports
- ✨ **Open Service** - Quick access via VSCode or file explorer
- ✨ **Update Command** - Self-update the installer
- ✨ **Version Tracking** - `.service-version` file for each service
- ✨ **Colorful UI** - Enhanced console output with tables

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

[](#requirements)

- PHP 8.2 or higher
- Composer
- Git
- Docker (optional, for running services)
- OpenSSL (for JWT key generation)

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

[](#installation)

### Global Installation (Recommended)

[](#global-installation-recommended)

Install globally via Composer:

```
composer global require ahmedessam/microservice-installer
```

Make sure your global Composer bin directory is in your system's PATH:

```
# Add to ~/.bashrc or ~/.zshrc (Linux/Mac)
export PATH="$HOME/.composer/vendor/bin:$PATH"

# Or add to your environment variables (Windows)
```

### Local Installation

[](#local-installation)

Or install locally in your project:

```
composer require ahmedessam/microservice-installer --dev
```

Then use it with:

```
./vendor/bin/microservice new service-name
```

Usage
-----

[](#usage)

### Quick Start

[](#quick-start)

```
# Check system requirements
microservice doctor

# Create a new microservice (basic)
microservice new auth-service

# Create with custom port
microservice new payment-service --port=8200

# Create with verbose output
microservice new order-service -v

# Preview without creating files
microservice new test-service --dry-run

# Auto-detect next available port
microservice new user-service --auto-port

# Skip JWT key generation
microservice new api-gateway --no-keys
```

### Interactive Mode

[](#interactive-mode)

Omit the service name to enter interactive wizard:

```
microservice new
? Enter service name: auth-service
? Enter port number (8100): 8100
```

### Dry Run Mode

[](#dry-run-mode)

Preview all changes before creating files:

```
microservice new test-service --dry-run --port=9000
```

Output:

```
┌─────────────────────────────────────────────────────────┐
│            DRY RUN - NO FILES WILL BE CREATED           │
└─────────────────────────────────────────────────────────┘

Service Configuration:
  • Service Name     : test-service
  • Port             : 9000
  • Template         : https://github.com/...
  • Generate JWT Keys: Yes

Operations to be performed:
  1. Clone template from GitHub
  2. Replace service name in templates
  ...

```

### Available Commands

[](#available-commands)

#### `microservice new [name]`

[](#microservice-new-name)

Create a new microservice.

**Options:**

- `-p, --port`: Port number (default: 8100)
- `-v, --verbose`: Show detailed output
- `--dry-run`: Preview changes without creating files
- `--auto-port`: Auto-detect next available port
- `--no-keys`: Skip JWT key generation

**Examples:**

```
microservice new auth-service
microservice new payment-service -p 8200 -v
microservice new test-service --dry-run
microservice new api-service --auto-port
```

#### `microservice doctor`

[](#microservice-doctor)

Check system requirements and configuration.

```
microservice doctor
```

Output shows:

- PHP version (&gt;= 8.2)
- Required PHP extensions
- Composer, Git, Docker availability
- Docker daemon status
- OpenSSL availability
- Write permissions
- Template repository accessibility

#### `microservice list`

[](#microservice-list)

List all microservices in current directory.

```
microservice list
```

Shows table with:

- Service name
- Port number
- Docker status (Running/Stopped)
- Full path

#### `microservice open `

[](#microservice-open-service)

Open a service in VSCode or file explorer.

```
microservice open auth-service
```

#### `microservice update`

[](#microservice-update)

Update the installer to the latest version.

```
microservice update
```

### Configuration File

[](#configuration-file)

Create `~/.microservice-config` to customize defaults:

```
default_port_start: 8100
jwt_auto_generate: true
template_repository: https://github.com/aahmedessam30/laravel-microservice-template
auto_detect_port: false
verbose_mode: false
editor_command: code
custom_replacements: []
```

### Complete Workflow Example

[](#complete-workflow-example)

```
# 1. Check system health
microservice doctor

# 2. Create services
microservice new auth-service -p 8100
microservice new user-service --auto-port
microservice new payment-service -p 8102 -v

# 3. List all services
microservice list

# 4. Open a service
microservice open auth-service

# 5. Start a service
microservice new user-service --port=8000

# Navigate to the service directory
cd user-service

# Install dependencies
composer install

# Generate Laravel application key
php artisan key:generate

# Start Docker containers
docker-compose up -d

# Run migrations
docker-compose exec php-fpm php artisan migrate

# Access the service
curl http://localhost:8000/api/health
```

What Gets Configured
--------------------

[](#what-gets-configured)

The installer automatically configures the following:

### 1. Service Identity

[](#1-service-identity)

- Updates `config/service.php` with service name and version
- Sets `SERVICE_NAME` in `.env` and `.env.example`

### 2. Application Settings

[](#2-application-settings)

- Updates `APP_NAME` in `.env`
- Sets unique `APP_PORT` for the service
- Updates `APP_URL` with the correct port

### 3. Database Configuration

[](#3-database-configuration)

- Creates unique database name: `{service-name}_db`
- Updates `DB_DATABASE` in `.env`

### 4. Cache &amp; Queue

[](#4-cache--queue)

- Sets unique `CACHE_PREFIX` to prevent collisions
- Configures Redis with service-specific prefixes

### 5. Docker Setup

[](#5-docker-setup)

- Updates all container names: `{service-name}-php`, `{service-name}-nginx`, etc.
- Configures unique port mapping
- Updates volume names for isolation

### 6. Composer Package

[](#6-composer-package)

- Updates `composer.json` name: `ahmedessam/{service-name}`
- Sets appropriate description

### 7. JWT Keys

[](#7-jwt-keys)

- Generates RSA key pair (2048-bit)
- Creates `keys/private.pem` and `keys/public.pem`
- Adds `keys/` to `.gitignore`

Service Naming Rules
--------------------

[](#service-naming-rules)

Service names must:

- Contain only lowercase letters, numbers, and hyphens
- Not start or end with a hyphen
- Be descriptive and meaningful (e.g., `auth-service`, `payment-gateway`)

✅ Valid names:

- `auth-service`
- `user-management`
- `payment-gateway`
- `notification-service`

❌ Invalid names:

- `Auth-Service` (uppercase)
- `-auth-service` (starts with hyphen)
- `auth_service` (underscores not allowed)
- `auth service` (spaces not allowed)

Port Management
---------------

[](#port-management)

Recommended port allocation strategy:

ServicePortAuth Service8000User Service8001Payment Service8002Order Service8003Notification Service8004......Or use incremental base (e.g., 8100, 8101, 8102...)

Architecture
------------

[](#architecture)

The installer follows clean architecture principles:

```
laravel-microservice-installer/
├── bin/
│   └── microservice              # Executable entry point
├── src/
│   ├── Commands/
│   │   └── NewServiceCommand.php # Main command logic
│   ├── Services/
│   │   ├── TemplateCloner.php    # Clones the template repo
│   │   ├── NameReplacer.php      # Replaces placeholders
│   │   ├── DockerConfigurator.php # Updates docker-compose.yml
│   │   ├── EnvConfigurator.php   # Configures .env files
│   │   ├── KeyGenerator.php      # Generates JWT keys
│   │   └── ComposerUpdater.php   # Updates composer.json
│   ├── Support/
│   │   ├── Filesystem.php        # File operations
│   │   └── ConsolePrinter.php    # Console output
│   └── MicroserviceInstaller.php # Application bootstrap
├── composer.json
└── README.md

```

### Design Principles

[](#design-principles)

- **Single Responsibility**: Each class has one focused purpose
- **Dependency Injection**: All dependencies injected via constructor
- **Strict Typing**: All parameters and returns are type-hinted
- **PSR-4 Autoloading**: Proper namespacing and autoloading
- **Testable**: Small, focused methods that are easy to test

Troubleshooting
---------------

[](#troubleshooting)

### "Failed to clone template repository"

[](#failed-to-clone-template-repository)

Ensure you have:

- Git installed and in your PATH
- Internet connection
- Access to GitHub

### "Failed to generate private key"

[](#failed-to-generate-private-key)

Ensure:

- OpenSSL extension is enabled in PHP
- You have write permissions in the current directory

### "Port must be between 1024 and 65535"

[](#port-must-be-between-1024-and-65535)

Use a valid port number:

```
microservice new service-name --port=8000
```

### "Directory already exists"

[](#directory-already-exists)

The service directory already exists. Choose a different name or remove the existing directory:

```
rm -rf service-name
microservice new service-name
```

Next Steps After Creation
-------------------------

[](#next-steps-after-creation)

1. **Install Dependencies**

    ```
    cd service-name
    composer install
    ```
2. **Generate Application Key**

    ```
    php artisan key:generate
    ```
3. **Start Docker Containers**

    ```
    docker-compose up -d
    ```
4. **Run Migrations**

    ```
    docker-compose exec php-fpm php artisan migrate
    ```
5. **Access API Documentation**

    ```
    http://localhost:{port}/api/docs

    ```
6. **Check Health Endpoint**

    ```
    curl http://localhost:{port}/api/health
    ```

Template Repository
-------------------

[](#template-repository)

This installer uses the official template:

- Repository: [aahmedessam30/laravel-microservice-template](https://github.com/aahmedessam30/laravel-microservice-template)
- Features: Laravel 12, Clean Architecture, Docker, JWT Auth, OpenAPI
- Architecture: Action/DTO/Service/Repository pattern

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

[](#contributing)

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

License
-------

[](#license)

This installer is open-source software licensed under the [MIT license](LICENSE).

Credits
-------

[](#credits)

- **Author**: Ahmed Essam
- **Template**: [laravel-microservice-template](https://github.com/aahmedessam30/laravel-microservice-template)
- **Inspired by**: [Laravel Installer](https://github.com/laravel/installer)

Support
-------

[](#support)

For issues, questions, or contributions:

- GitHub Issues: [Create an issue](https://github.com/aahmedessam30/microservice-installer/issues)
- Email:

---

**Made with ❤️ for Laravel Microservices**

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance69

Regular maintenance activity

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

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

Unknown

Total

1

Last Release

179d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/14383efd445985cf037e39f51ce0228eab1800ddf41cd845457daae1bcd8c192?d=identicon)[aahmedessam30](/maintainers/aahmedessam30)

---

Top Contributors

[![aahmedessam30](https://avatars.githubusercontent.com/u/63825434?v=4)](https://github.com/aahmedessam30 "aahmedessam30 (1 commits)")

---

Tags

clilaravelinstallerdockermicroservices

###  Code Quality

TestsPest

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ahmedessam-microservice-installer/health.svg)

```
[![Health](https://phpackages.com/badges/ahmedessam-microservice-installer/health.svg)](https://phpackages.com/packages/ahmedessam-microservice-installer)
```

###  Alternatives

[n98/magerun

Tools for managing Magento projects and installations

1.4k264.7k7](/packages/n98-magerun)[n98/magerun2

Tools for managing Magento projects and installations

928244.3k6](/packages/n98-magerun2)[fly-apps/dockerfile-laravel

Dockerfile generator and Fly.io helper.

30105.0k](/packages/fly-apps-dockerfile-laravel)

PHPackages © 2026

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