PHPackages                             codenamephp/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. codenamephp/installer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

codenamephp/installer
=====================

Installer that uses template folders to setup projects, e.g. from a github template repository

2.0.0(2y ago)072[1 PRs](https://github.com/codenamephp/installer/pulls)Apache-2.0PHPPHP ^8.2CI passing

Since Jan 10Pushed 1y ago1 watchersCompare

[ Source](https://github.com/codenamephp/installer)[ Packagist](https://packagist.org/packages/codenamephp/installer)[ RSS](/packages/codenamephp-installer/feed)WikiDiscussions release Synced 3w ago

READMEChangelog (3)Dependencies (3)Versions (6)Used By (0)

Installer
=========

[](#installer)

[![Packagist Version](https://camo.githubusercontent.com/9f863bd1b3ced046521e278aab88f5bbe693478b67cfd896a1952a21b3cb2a61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/9f863bd1b3ced046521e278aab88f5bbe693478b67cfd896a1952a21b3cb2a61/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656e616d657068702f696e7374616c6c6572)[![Packagist PHP Version Support](https://camo.githubusercontent.com/04b10f643acfa5287cc9de2b12b25bf8d92c9f54247dc3b36962ebb2449395c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/04b10f643acfa5287cc9de2b12b25bf8d92c9f54247dc3b36962ebb2449395c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f636f64656e616d657068702f696e7374616c6c6572)[![Lines of code](https://camo.githubusercontent.com/e5909a5532b66ded1a698d592c09bed5b18d67bfe9626d663914b030b2ee1a28/68747470733a2f2f696d672e736869656c64732e696f2f746f6b65692f6c696e65732f6769746875622f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/e5909a5532b66ded1a698d592c09bed5b18d67bfe9626d663914b030b2ee1a28/68747470733a2f2f696d672e736869656c64732e696f2f746f6b65692f6c696e65732f6769746875622f636f64656e616d657068702f696e7374616c6c6572)[![GitHub code size in bytes](https://camo.githubusercontent.com/5c85730bdddf012d460b8d09528f598c73d9ba6b364faf0e2c39bb06994e341a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/5c85730bdddf012d460b8d09528f598c73d9ba6b364faf0e2c39bb06994e341a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f636f64656e616d657068702f696e7374616c6c6572)[![CI](https://github.com/codenamephp/installer/workflows/CI/badge.svg)](https://github.com/codenamephp/installer/workflows/CI/badge.svg)[![Packagist Downloads](https://camo.githubusercontent.com/1f88e82b58e2c694dde6af4e45b17c8b918a060250b13ccaf29875be7ffb65df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/1f88e82b58e2c694dde6af4e45b17c8b918a060250b13ccaf29875be7ffb65df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656e616d657068702f696e7374616c6c6572)[![GitHub](https://camo.githubusercontent.com/a09d12567dbabc82893404b30eab177c4c23cb00feb4fcd373bc649592a42708/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f64656e616d657068702f696e7374616c6c6572)](https://camo.githubusercontent.com/a09d12567dbabc82893404b30eab177c4c23cb00feb4fcd373bc649592a42708/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f636f64656e616d657068702f696e7374616c6c6572)

Installer that uses template folders to setup projects, e.g. from a github template repository

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

[](#installation)

Easiest way is via composer. Just run `composer require codenamephp/installer` in your cli which should install the latest version for you.

Usage
-----

[](#usage)

The idea is to have a start script in a subfolder. The script itself just sets up the installer and the dependencies and by that also what the installer is actually doing. The reason to put it in its own folder is so the files are clearly separated from the rest of the files so the installer can easily remove itself.

First require the installer package using composer so we can start using its classes.

Best practice is to create a `.installer` folder and an `install.php`. The following example will render the files in the `.installer/templates` folder into the parent folder replacing all eisting files and replacing all variables in the templates with the variables form the array. Once this is done the `.installer` folder is deleted.

There's also variable replacement in paths. In this example, a framed replacer is used so common folder names that also might appear as variable are not replaced by accident (like "vendor" in this example). The default for the prefix and suffix is '\_\_' so if a file `.installer/templates/files/__vendor__/__componentName__.json` would exist it would end up in `files/codenamephp/some.component.json`so you can change the final structure on the fly (e.g. have a folder structure that matches your namespace).

`.installer/install.php`:

```
use de\codenamephp\installer\StepExecutor;
use de\codenamephp\installer\steps\CopyTemplateFolder;
use de\codenamephp\installer\steps\CreateFolders;
use de\codenamephp\installer\steps\DeleteFilesAndFolders;
use de\codenamephp\installer\steps\SequentialCollection;
use de\codenamephp\installer\templateCopy\directoryHandler\CreateDirectoryWithSymfonyFilesystem;
use de\codenamephp\installer\templateCopy\fileHandler\RenderWithTwigAndDumpWithSymfonyFilesystem;
use de\codenamephp\installer\templateCopy\variableReplacer\FramedStringReplace;
use Symfony\Component\Filesystem\Filesystem;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

return call_user_func(static function() {
  require_once __DIR__ . '/../vendor/autoload.php';

  $filesystem = new Filesystem();
  $variableReplacer = new FramedStringReplace();
  $componentName = basename(trim(shell_exec("git config --get remote.origin.url")), '.git');
  $variables = [
            'vendor' => 'codenamephp',
            'componentName' => $componentName,
            'namespace' => implode('\\', array_merge(['de', 'codenamephp'], explode('.', $componentName)))
          ];

  (new StepExecutor(
    new SequentialCollection(
      new CopyTemplateFolder(
        new \de\codenamephp\installer\templateCopy\RecursiveIterator(
          new CreateDirectoryWithSymfonyFilesystem($filesystem,$variableReplacer),
          new RenderWithTwigAndDumpWithSymfonyFilesystem($filesystem, $variableReplacer, new Environment(new FilesystemLoader('/', '/')))
        ),
        __DIR__ . '/templates',
        dirname(__DIR__),
        $variables
      ),
      new CreateFolders($variableReplacer, $filesystem, [dirname(__DIR__) . '/src'], $variables),
      new DeleteFilesAndFolders($variableReplacer, $filesystem, [__DIR__], $variables),
    )
  ))->run();
});
```

`.installer/templates/composer.json`:

```
{
  "name": "{{vendor}}/{{componentName}}",
  "description": "",
  "type": "library",
  "license": "Apache-2.0",
  "require": {
    "php": "^8.0"
  },
  "require-dev": {
    "dealerdirect/phpcodesniffer-composer-installer": "^0.7",
    "phpcompatibility/php-compatibility": "^9.0",
    "squizlabs/php_codesniffer": "^3.5",
    "mikey179/vfsstream": "^1.6.8"
  },
  "autoload": {
    "psr-4": {
      "{{namespace|replace({'\\':'\\\\'})}}\\": [
        "src"
      ]
    }
  },
  "autoload-dev": {
    "psr-4": {
      "{{namespace|replace({'\\':'\\\\'})}}\\test\\": [
        "test"
      ]
    }
  }
}
```

`.installer/templates/README.md`:

```
# {{componentName}}

![Packagist Version](https://img.shields.io/packagist/v/{{vendor}}/{{componentName}})
![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/{{vendor}}/{{componentName}})
![Lines of code](https://img.shields.io/tokei/lines/github/{{vendor}}/{{componentName}})
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/{{vendor}}/{{componentName}})
![CI](https://github.com/{{vendor}}/{{componentName}}/workflows/CI/badge.svg)
![Packagist Downloads](https://img.shields.io/packagist/dt/{{vendor}}/{{componentName}})
![GitHub](https://img.shields.io/github/license/{{vendor}}/{{componentName}})

## Installation

Easiest way is via composer. Just run `composer require {{vendor}}/{{componentName}}` in your cli which should install the latest version for you.

## Usage
```

This example could be part of a GitHub template repository. After the repository was created on GitHub the repo can be cloned to local and after running `composer install && php .installer/install.php && composer update` the repo would be ready for development.

This example can be adapted to the repository needs. Since the installer itself only executes steps custom steps can be added in the repository by implementing the `\de\codenamephp\installer\steps\iStep` interface and adding it to the installer.

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 91.5% 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 ~546 days

Total

3

Last Release

908d ago

Major Versions

1.1.0 → 2.0.02024-01-07

PHP version history (2 changes)1.0.0PHP ^8.0

2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6865819?v=4)[Bastian Schwarz](/maintainers/bastianschwarz)[@bastianschwarz](https://github.com/bastianschwarz)

---

Top Contributors

[![bastianschwarz](https://avatars.githubusercontent.com/u/6865819?v=4)](https://github.com/bastianschwarz "bastianschwarz (54 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[phpactor/phpactor

PHP refactoring and intellisense tool for text editors

1.9k17.1k1](/packages/phpactor-phpactor)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[metamodels/core

MetaModels core

10156.4k68](/packages/metamodels-core)

PHPackages © 2026

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