A generated project after a clean clone: what “works immediately” means

Accept a Symfony 7.4 fixture after a clean clone: fresh inventory, unchanged dependency versions, environment setup, bootstrap hashes, and four refusals.

A ready kit is checked by assembling it from a clean start.
A ready kit is checked by assembling it from a clean start.

After project generation, the directory can look complete: a controller, configuration, a README, and a start command are all present. But the template author also sees an installed vendor/ directory, local environment settings, and files that never entered Git. The next person receives only the repository. The difference between “code has been created” and “the project can be started” often hides between these two states.

This transition needs its own acceptance criterion. The teaching reading-room generator creates two routes and settings for one fictional site. The complete experiment confirmed bootstrap after a clean clone without manual PHP repair. Canonical article_demo remains one Symfony 8.1 project; the Symfony 7.4 source and clone created here are only disposable acceptance fixtures rather than additional applications in the series.

First define what “immediately” means

The phrase becomes testable when the starting state and permitted actions are written down. Here, that means a new directory after git clone, PHP 8.2 or newer with the required extensions, Composer, Python 3, Git, Bash, and Unix cmp/mktemp utilities. Network access is needed to download public dependencies. The bootstrap command may create the documented local environment files, install dependencies, and warm the cache. It must not require manual repairs to the generated PHP.

Symfony 7.4 defines the scope of this teaching template. Its official documentation describes skeleton creation through Composer and the requirements of that branch; it does not establish that our new generator works. Installing Symfony 7.4.

The experiment has two distinct phases:

Phase Permitted work What passes to the next phase
Source preparation Create the skeleton, select dependencies, apply the template, make a commit Generated code, genuine composer.lock and symfony.lock files, recorded inputs
Acceptance after clone Read the committed state, create local configuration, run composer install and the checks An observed execution result for that specific commit

The first phase actually resolved dependencies under the 7.4.* and ^11.5 constraints. This run obtained FrameworkBundle and BrowserKit 7.4.23 and PHPUnit 11.5.57 on PHP 8.5.12, Composer 2.9.2, and Python 3.12.3. These are versions observed in one run rather than a promise about future resolution. The second phase uses the genuine committed lock through install. Composer basics.

The generator changes composer.json metadata and adds test autoloading. Source preparation therefore runs composer update --lock --no-install to refresh the lock content hash, checking that every dependency’s version/source/dist identity remains unchanged. Only then is the commit created. Clone acceptance performs no update and chooses no different package set.

A small template with explicit inputs

Three values are enough for the teaching site:

{
  "template": "reading-room-v1",
  "site_key": "harbour",
  "site_label": "Harbour Reading Room"
}

template identifies the exact revision of our template. site_key becomes a service configuration value, while site_label enters the sample local environment. The generator accepts only these fields and a limited character set. It rejects unknown revisions, duplicate JSON keys, extra fields, and values that could break a file's syntax. This is a deliberate limit of the small example, not a general system for localized names.

A file manifest accompanies the template. Before writing, the generator checks both the file set and its contents, then leaves teaching-input.json and template-lock.json in the result. This separates input changes, template changes, and dependency changes. Checking the integrity of this local set does not, by itself, establish who is authorized to publish a template.

After creating the official skeleton and installing test dependencies, the controlled runner records a one-time inventory. Before writing, the generator checks the exact file set and bytes outside vendor/var/.git, rejects symlinks in that area, and consumes the inventory. This is a prerequisite for a fresh disposable destination rather than permission to rewrite an existing project or protection against a forged inventory.

All input validation finishes before the first write. Filesystem errors have no automatic rollback, so the generator is intended only for a new disposable skeleton. The example refuses to run again against an already generated site. Updating an existing project needs a different contract covering local changes, conflicts, and migrations.

Clone must break the dependency on the working directory

After preparing the source, the runner creates a local Git repository and a commit. That commit must include code, configuration, tests, the environment template, and both lock files. vendor/, var/, .env.local, and .env.test.local remain outside the versioned set.

Generated config/reference.php is also ignored before the first Git add/commit. This regenerable file never becomes part of the accepted source. The check verifies that it is untracked rather than relying on an ignore rule added afterwards.

The source then deliberately receives a local environment file with a harmless marker and an uncommitted local-only.txt. The acceptance copy is created in another directory using git clone --no-local. For a local source, this option uses the regular Git transport instead of the local object-copying optimization. This is still an experiment on one machine. git clone documentation.

Before dependency installation, the check must confirm the same commit, a clean working tree, and the absence of both deliberately local files, vendor/, and var/. Copying the whole directory would not provide that evidence: it could silently carry across precisely the files the next developer should not depend on.

The runner separately checks that prohibited local paths have not been added to Git. A .gitignore file alone is insufficient: ignore rules do not remove files that are already tracked. gitignore documentation.

Local configuration is a documented step, not hidden assistance

Before creating environment files or installing dependencies, bootstrap checks required committed inputs and every generated_files hash in template-lock.json. An altered generated file is rejected at this boundary. This checks a local recorded set rather than digitally certifying the template’s origin.

The generated .env contains teaching values and the SET_LOCALLY marker. APP_SECRET is explicitly a teaching value and unsuitable for deployment. The useful room label lives in .env.example. Bootstrap uses it to create .env.local and .env.test.local.

The second file is intentional: Symfony's test environment does not use .env.local in the same way as the normal development environment. A locally working page therefore does not establish that a test received the same setting. Symfony environments and environment files.

If either local file already contains different content, bootstrap stops and preserves it. It does not decide on the user's behalf whether their configuration should be erased. This narrow experiment accepts only the exact teaching contents of .env.example; it is not a secret-management design for a future product.

Bootstrap clears inherited APP_ENV/APP_DEBUG/APP_SECRET/DEMO_LABEL and Composer overrides, including COMPOSER_NO_DEV. It then explicitly installs with --dev so an ambient flag cannot silently omit test dependencies. This isolates the synthetic experiment: environment files come from the documented teaching example rather than hidden working settings.

Configuration is followed by composer install, platform requirements checking, YAML and container checks, and clearing the test cache. composer check-platform-reqs checks the actual PHP runtime and extensions, rather than only assumptions in the dependency file. Composer commands.

Two responses to require from generated code

The route contract is intentionally short:

teaching_health:
    path: /health
    controller: App\Controller\ShelfController::health
    methods: [GET]

teaching_shelf:
    path: /shelf
    controller: App\Controller\ShelfController::shelf
    methods: [GET]

GET /health should return JSON with status: ok. GET /shelf should return site: harbour, label: Harbour Reading Room, and template: reading-room-v1. The check compares the specific content, not merely status 200. Otherwise, an unrelated service page could answer in place of the expected capability.

10 PHPUnit methods ran with 14 assertions. Eight use the Symfony kernel: two main responses, a missing route with 404, two rejected POST requests with 405, an empty HEAD body, identity unchanged by query parameters, and JSON Content-Type. Two more reject an empty label and SET_LOCALLY in the configuration object.

BrowserKit performs these requests without a real HTTP server. The check covers application behavior in the test kernel; it does not check DNS, TLS, Nginx, PHP-FPM permissions, or a browser. Symfony testing.

Four refusals that make bootstrap more honest

Alongside the successful path, the runner checked four separate fresh clones with controlled defects:

Defect Observed behaviour Exit code
Missing composer.lock Stop before install without resolving again 2
Missing .env.example Stop before creating local environment files 2
Existing .env.local with a different value Preserve the file without overwrite 3
Altered generated file Reject against template-lock before creating env 2

The complete runner finished successfully. The clean clone retained the same source commit, exact /health and /shelf routes, unchanged dependency/input locks, and a clean Git working tree after bootstrap. No vendor or .env.test.local appeared in the four negative clones, and the conflicting .env.local was preserved. Ten PHP checks and four negative bootstrap scenarios form 14 acceptance scenarios.

Run the complete scenario from the teaching package directory:

bash example/run-lab.sh

A separate set of 16 Python/Git structural checks exercises the generator with a filesystem fixture whose Kernel.php is test text and which performs no Composer resolution. These are not another 16 Symfony tests. They do not replace the executed clean-clone bootstrap or verify the real platform generator.

Readiness has a boundary

Acceptance here means that a particular generated commit can be cloned, configured with the documented command, and made to return the agreed responses without manual code repair. It does not mean that every template revision produces the same result, that dependencies will always be available over the network, or that the application is ready for production.

A database, migrations, authentication, external integrations, and deployment are outside this small site. Adding any of them introduces prerequisites and new checks after a clean clone. A generator's promise can expand gradually in precisely this way: alongside a concrete, repeatable contract that another person can execute.

  1. PHP PHP and Composer: what to check beyond the version number
  2. Vendors & Packages A package works in the project: why that is not enough for a separate release
  3. Products Incompatible configurator options: explaining rejection to the user
  4. Platform Engineering When a prototype becomes a product: an evidence matrix for one end-to-end scenario

A project by the author · Weather Solution200

After reading, a look outside.

Temperature, rain and wind in your city. Check the forecast and plan the hours ahead.

Check the forecast
Next article