<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Vladyslav</title>
    <description>The latest articles on DEV Community by Vladyslav (@velhbxtyrj).</description>
    <link>https://dev.to/velhbxtyrj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3961924%2Fdd39f15b-7a18-4118-94c4-83a7f7d76170.jpg</url>
      <title>DEV Community: Vladyslav</title>
      <link>https://dev.to/velhbxtyrj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/velhbxtyrj"/>
    <language>en</language>
    <item>
      <title>Deterministic Does Not Mean Alphabetical: Dependency Ordering in PHP Package Tooling</title>
      <dc:creator>Vladyslav</dc:creator>
      <pubDate>Mon, 16 Nov 2026 03:50:31 +0000</pubDate>
      <link>https://dev.to/velhbxtyrj/deterministic-does-not-mean-alphabetical-dependency-ordering-in-php-package-tooling-182m</link>
      <guid>https://dev.to/velhbxtyrj/deterministic-does-not-mean-alphabetical-dependency-ordering-in-php-package-tooling-182m</guid>
      <description>&lt;p&gt;&lt;em&gt;Coretsia Engineering Notes — 01&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Two package installers can generate exactly the same set of autoload entries for the same application and still produce different runtime behavior. One generated bootstrap initializes successfully, while the other fails with an undefined-function error before reaching the application's own entry point. The difference lies not in which files were installed, but in the order in which they are executed.&lt;/p&gt;

&lt;p&gt;Sorting generated PHP artifacts alphabetically may seem like a straightforward way to achieve determinism. While this approach works well for unordered collections, executable initialization sequences require stronger guarantees: their ordering must preserve the underlying dependency relationships.&lt;/p&gt;

&lt;h2&gt;
  
  
  When deterministic ordering breaks application startup
&lt;/h2&gt;

&lt;p&gt;While exploring PHP package tooling, I came across an interesting problem involving the order of generated autoload entries. A package installer can correctly identify every file that needs to be included, yet generate an invalid initialization sequence by sorting packages alphabetically instead of respecting their dependency relationships. If a package invokes a function provided by one of its dependencies during initialization, loading the dependent package first may cause application startup to fail despite all required packages being correctly installed.&lt;/p&gt;

&lt;p&gt;This raises an important engineering question: what does it actually mean for a generated artifact to be deterministic? Comparing package lists, file counts or unordered collections of autoload entries is insufficient when execution order is itself part of the contract.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why &lt;code&gt;autoload.files&lt;/code&gt; is different
&lt;/h2&gt;

&lt;p&gt;PHP's class autoloading mechanism can resolve a class when it is needed, but it does not provide an equivalent mechanism for discovering arbitrary standalone function definitions. Composer's &lt;code&gt;autoload.files&lt;/code&gt; addresses this by eagerly including designated PHP files when &lt;code&gt;vendor/autoload.php&lt;/code&gt; is required, after the class loader has been registered.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://getcomposer.org/doc/04-schema.md#files" rel="noopener noreferrer"&gt;Composer schema documentation&lt;/a&gt; defines dependency-aware inclusion order, alphabetical ordering for equally ranked packages, and the placement of root-package files after dependency files. This distinction matters because an &lt;code&gt;autoload.files&lt;/code&gt; entry is not simply a path in a lookup table: it represents executable PHP code. If that code invokes a function supplied by another package during inclusion, the function must already exist.&lt;/p&gt;

&lt;h2&gt;
  
  
  A minimal reproduction
&lt;/h2&gt;

&lt;p&gt;To isolate the underlying ordering problem, I prepared a minimal reproduction consisting of two local PHP packages, without external package dependencies. The package names are intentional: &lt;code&gt;application&lt;/code&gt; sorts before &lt;code&gt;helpers&lt;/code&gt;, even though the dependency must be initialized first.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;acme/application requires acme/helpers
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;packages/helpers/composer.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"acme/helpers"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"autoload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"functions.php"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;packages/helpers/functions.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nc"&gt;Acme&lt;/span&gt;\&lt;span class="nc"&gt;Helpers&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s1"&gt;'Application initialized'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;packages/application/composer.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"acme/application"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"version"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"require"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"acme/helpers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"autoload"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"bootstrap.php"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;packages/application/bootstrap.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; \&lt;span class="nc"&gt;Acme&lt;/span&gt;\&lt;span class="nc"&gt;Helpers&lt;/span&gt;\&lt;span class="nf"&gt;greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PHP_EOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The reproduction script reads the local package manifests, extracts their declared dependencies and autoload files, and selects one of two ordering strategies. Unlike a hard-coded inclusion sequence, this allows the dependency-aware order to be derived directly from package metadata. The experiment operates on a predefined package collection without performing version resolution or package installation. The &lt;code&gt;graph&lt;/code&gt; strategy uses the &lt;code&gt;dependencyOrder()&lt;/code&gt; function defined in &lt;code&gt;order.php&lt;/code&gt;, presented later in the article.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;reproduce.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/order.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$mode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;in_array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$mode&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'lexical'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'graph'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;fwrite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;STDERR&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Usage: php reproduce.php lexical|graph\n"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$requires&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;glob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/packages/*/composer.json'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$manifestPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$manifest&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;json_decode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;file_get_contents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$manifestPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;512&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;JSON_THROW_ON_ERROR&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$manifest&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'name'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$manifest&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'require'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;dirname&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$manifestPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nv"&gt;$manifest&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'autoload'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'files'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$mode&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'lexical'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SORT_STRING&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dependencyOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Order: '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;implode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;' -&amp;gt; '&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PHP_EOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$order&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="nv"&gt;$file&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before running the following commands, save the reproduction files, including &lt;code&gt;order.php&lt;/code&gt; presented later in the article, and execute the commands from the project root. I executed both strategies in separate PHP processes on Windows using PHP 8.4.24, without invoking Composer. The first execution uses alphabetical ordering:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php reproduce.php lexical
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output (local paths and stack trace omitted):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Order: acme/application -&amp;gt; acme/helpers
PHP Fatal error: Uncaught Error: Call to undefined function Acme\Helpers\greeting()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The second execution derives the order from the dependency graph:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php reproduce.php graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Order: acme/helpers -&amp;gt; acme/application
Application initialized
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Ordering&lt;/th&gt;
&lt;th&gt;Execution sequence&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Alphabetical&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;application&lt;/code&gt; → &lt;code&gt;helpers&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Undefined function&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Dependency-first&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;helpers&lt;/code&gt; → &lt;code&gt;application&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Successful initialization&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both strategies operate on the same package metadata and the same collection of PHP files. The alphabetical strategy attempts to initialize the dependent package before its prerequisite and fails, while the dependency-aware strategy preserves the declared relationship and completes the bootstrap successfully. This experiment isolates the ordering failure without implementing a complete package installer or relying on the behavior of any particular third-party installation tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Composer as a reference
&lt;/h2&gt;

&lt;p&gt;To compare the experiment with real Composer-generated artifacts, add this root &lt;code&gt;composer.json&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"example/dependency-ordering-reproduction"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"A local, two-package fixture for files autoload ordering"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"project"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"require"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nl"&gt;"php"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"^8.4"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="nl"&gt;"acme/application"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"1.0.0"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"repositories"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"packagist.org"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"packages/*"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"options"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"symlink"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using Composer 2.10.2 with PHP 8.4.24, I resolved and installed both local packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;composer update --no-interaction --no-scripts --no-plugins
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Composer successfully resolved the declared dependency, installed both packages and generated the autoload artifacts. To verify the generated file order and execute the actual autoloader, the reproduction includes a separate verification script.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;composer-check.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$files&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/vendor/composer/autoload_files.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nv"&gt;$paths&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;array_map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;str_replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'\\'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'/'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;array_values&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$files&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$find&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$suffix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paths&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;int&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$paths&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$index&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;str_ends_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$suffix&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$index&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing generated entry: $suffix"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/acme/helpers/functions.php'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="nv"&gt;$find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/acme/application/bootstrap.php'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Dependency must precede dependent'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/vendor/autoload.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Composer ordering verified'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PHP_EOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the verification:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php composer-check.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Application initialized
Composer ordering verified
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The verification confirms two properties: the generated autoload file map places the dependency before the dependent package, and the actual Composer autoloader initializes the application successfully. Checking both properties is important because inspecting generated metadata alone does not establish that the generated bootstrap is executable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Determinism and correctness are separate properties
&lt;/h2&gt;

&lt;p&gt;For a package dependency edge, define the ordering invariant as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A requires B  =&amp;gt;  index(B) &amp;lt; index(A)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For an acyclic resolved graph, this is a topological-ordering problem. There may be multiple valid orders, and determinism selects a reproducible one without removing the underlying invariant. One way to implement that selection is Kahn's algorithm with a deterministic tie-breaker:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Count unresolved dependencies for each package.&lt;/li&gt;
&lt;li&gt;Collect packages that have no remaining prerequisites.&lt;/li&gt;
&lt;li&gt;Select the lexically smallest eligible package.&lt;/li&gt;
&lt;li&gt;Emit it, decrement the remaining dependency counts of its dependents, and repeat.&lt;/li&gt;
&lt;li&gt;If unprocessed packages remain but none are eligible, reject the graph under an acyclic-graph policy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The significant property of this algorithm is that the next package in the output sequence is selected lexically from the currently eligible packages. The following educational implementation operates on a predefined dependency graph and is used by the reproduction script.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;order.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * Educational DAG sorter, not a Composer PackageSorter implementation.
 *
 * @param array&amp;lt;string, list&amp;lt;string&amp;gt;&amp;gt; $requires Resolved package dependencies.
 * @return list&amp;lt;string&amp;gt;
 */&lt;/span&gt;
&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;dependencyOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$remaining&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$dependents&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;$dependencies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nv"&gt;$dependencies&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_unique&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dependencies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$remaining&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dependencies&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dependencies&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$dependency&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nf"&gt;array_key_exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dependency&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Missing dependency: $dependency"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;

            &lt;span class="nv"&gt;$dependents&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$dependency&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$ready&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$remaining&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;$order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ready&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ready&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;SORT_STRING&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;array_shift&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ready&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="nv"&gt;$order&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

        &lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$dependents&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nv"&gt;$dependent&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="nv"&gt;$remaining&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$dependent&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="nv"&gt;$ready&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$dependent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$order&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nb"&gt;count&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Dependency cycle'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nv"&gt;$order&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For the reproduction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nv"&gt;$order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;dependencyOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/application'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'acme/helpers'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/helpers'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// ['acme/helpers', 'acme/application']&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The dependency relationship constrains the sequence first, while string ordering resolves ambiguity between eligible packages. To verify this behavior beyond the two-package example, the following script checks transitive dependencies, input-order independence, deterministic tie-breaking, duplicate dependency edges, empty graphs, missing dependencies and cycles.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;checks.php&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="n"&gt;php&lt;/span&gt;

&lt;span class="k"&gt;declare&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strict_types&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;require&lt;/span&gt; &lt;span class="n"&gt;__DIR__&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="s1"&gt;'/order.php'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;expectOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;dependencyOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="nv"&gt;$expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Unexpected dependency order'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;expectFailure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;array&lt;/span&gt; &lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nf"&gt;dependencyOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$requires&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;LogicException&lt;/span&gt; &lt;span class="nv"&gt;$exception&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$exception&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="nf"&gt;getMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nv"&gt;$message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="nv"&gt;$exception&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;LogicException&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'Expected graph rejection'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nv"&gt;$graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/application'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'acme/bridge'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/bridge'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'acme/helpers'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/helpers'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s1"&gt;'acme/extra'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nv"&gt;$expected&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'acme/extra'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'acme/helpers'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'acme/bridge'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'acme/application'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;expectOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expectOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;array_reverse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$graph&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$expected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expectOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'z'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'z'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'z'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'a'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expectOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expectFailure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'missing'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Missing dependency: missing'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nf"&gt;expectFailure&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'b'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'b'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'a'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'Dependency cycle'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'Graph checks passed'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;PHP_EOL&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the checks:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;php checks.php
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Graph checks passed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These checks verify both valid ordering behavior and the rejection of invalid dependency graphs. Reversing the input arrangement preserves the expected sequence, while missing dependencies and dependency cycles are explicitly rejected.&lt;/p&gt;

&lt;p&gt;This implementation is intentionally limited to resolved dependency graphs and is not a replacement for Composer's &lt;code&gt;PackageSorter&lt;/code&gt;. Composer has its own dependency-weight policy, package semantics and root-package handling. A compatible installer must additionally account for virtual packages, replacements, platform requirements, development dependencies and Composer's behavior on cyclic graphs. Producing a valid deterministic topological order for an acyclic graph is therefore not sufficient to establish full Composer compatibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same distinction in framework composition
&lt;/h2&gt;

&lt;p&gt;The same distinction between canonical ordering and dependency-aware execution exists in &lt;a href="https://github.com/coretsia/monorepo" rel="noopener noreferrer"&gt;Coretsia&lt;/a&gt;, the modular PHP framework I am developing. Coretsia relies on Composer for package installation, while its kernel resolves enabled framework modules and uses the resolved module plan to build application artifacts and compile the container graph. These responsibilities operate at different architectural boundaries, but share the requirement to preserve dependency semantics.&lt;/p&gt;

&lt;p&gt;Coretsia's module dependency graph is distinct from Composer's package dependency graph. Framework module dependencies are declared through &lt;code&gt;extra.coretsia.requires&lt;/code&gt; metadata and expressed in terms of module identifiers rather than Composer package names. Within the resolved &lt;code&gt;ModulePlan&lt;/code&gt;, the &lt;code&gt;enabled()&lt;/code&gt; and &lt;code&gt;excluded()&lt;/code&gt; collections are represented as canonical, sorted lists of unique module identifiers, while &lt;code&gt;topologicalOrder()&lt;/code&gt; preserves the dependency-first sequence without alphabetical re-sorting.&lt;/p&gt;

&lt;p&gt;The current implementation distributes these responsibilities across dedicated components:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Responsibility&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ModuleGraphResolver&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Expands the required dependency closure and handles missing dependencies, exclusions and conflicts before topological ordering.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TopologicalSorter&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Computes dependency-first order for enabled modules and detects dependency cycles.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ModulePlan&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Stores canonical enabled and excluded module sets separately from the resolved topological order, preserving the latter without alphabetical re-sorting.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ContainerProviderPlanResolver&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Builds the provider plan in topological module order, preserving provider declaration order within each module.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;RuntimeContainerGraphCompiler&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Invokes container definition providers in the resolved provider order, merges their definitions and compiles the container graph.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ModuleManifestBuilder&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Builds the &lt;code&gt;module-manifest@1&lt;/code&gt; artifact using the canonical &lt;code&gt;ModulePlan&lt;/code&gt; payload.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;ModulePlanArtifactHydrator&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Hydrates the module plan, validates its graph semantics and rejects an artifact whose topological order differs from the recomputed canonical order.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The kernel's &lt;code&gt;TopologicalSorter&lt;/code&gt; follows the same general topological-ordering principle as the educational algorithm presented earlier, but operates on enabled &lt;code&gt;ModulePlanEntry&lt;/code&gt; instances rather than Composer package manifests. It delegates deterministic string ordering to Foundation's &lt;code&gt;DeterministicOrder&lt;/code&gt;, which uses byte-order comparison through &lt;code&gt;strcmp()&lt;/code&gt; when priorities are equal. All module identifiers receive equal priority for this operation, so the next module is selected from the currently eligible identifiers in ascending byte order.&lt;/p&gt;

&lt;p&gt;Unlike the educational implementation, Coretsia separates missing dependency classification from topological sorting. &lt;code&gt;ModuleGraphResolver&lt;/code&gt; expands the required dependency closure and handles missing or excluded dependencies and enabled-module conflicts before invoking the sorter. &lt;code&gt;TopologicalSorter&lt;/code&gt; considers only the enabled module graph, detects cycles and preserves dependency precedence without re-sorting the resulting sequence alphabetically.&lt;/p&gt;

&lt;h3&gt;
  
  
  Evidence from the Coretsia test suite
&lt;/h3&gt;

&lt;p&gt;The distinction is explicitly covered by &lt;code&gt;TopologicalSorterDeterministicOrderTest&lt;/code&gt;. One of its synthetic test graphs makes &lt;code&gt;core.kernel&lt;/code&gt; depend on &lt;code&gt;platform.cli&lt;/code&gt;, forcing &lt;code&gt;platform.cli&lt;/code&gt; to precede &lt;code&gt;core.kernel&lt;/code&gt; even though its identifier sorts after it alphabetically. These relationships belong to the test fixture and do not represent the production dependency graph of Coretsia. The test asserts the following topological order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;core.foundation
platform.cli
core.kernel
platform.http
platform.routing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Additional tests compare the resulting order across different input arrangements and available collation locales, verify that provider planning follows the resolved module order, and ensure that providers retain their declared order within each module. The relevant tests include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;TopologicalSorterDeterministicOrderTest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ContainerProviderPlanUsesTopologicalModuleOrderTest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ContainerProviderPlanPreservesDeclaredProviderOrderTest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RuntimeContainerGraphCompilerUsesProviderPlanTest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ModulePlanArtifactHydratorContractTest&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The provider-order contract has observable consequences beyond ordering metadata. &lt;code&gt;RuntimeContainerGraphCompilerUsesProviderPlanTest&lt;/code&gt; verifies that reversing the declared provider sequence changes which implementation is selected for the &lt;code&gt;ClockInterface&lt;/code&gt; alias in the compiled container graph. &lt;code&gt;ModulePlanArtifactHydratorContractTest&lt;/code&gt; independently verifies that invalid topological ordering and cyclic dependency graphs are rejected.&lt;/p&gt;

&lt;p&gt;The Kernel implementation and its tests are located under &lt;code&gt;packages/core/kernel/&lt;/code&gt;, while the shared &lt;code&gt;DeterministicOrder&lt;/code&gt; primitive belongs to &lt;code&gt;packages/core/foundation/&lt;/code&gt;. The module graph semantics are documented in &lt;code&gt;docs/adr/ADR-0025-kernel-conflicts-exclusion-policy.md&lt;/code&gt;. These components address framework module composition and container compilation, rather than Composer autoload generation. The connection between these systems is a shared engineering invariant: deterministic representation must never override semantic dependency order.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would test in package tooling
&lt;/h2&gt;

&lt;p&gt;If I were reviewing a new autoload generator, I would want at least these tests:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A dependency whose name sorts after the dependent must still load first.&lt;/li&gt;
&lt;li&gt;A transitive relationship must survive even when an intermediate package has no &lt;code&gt;autoload.files&lt;/code&gt; entries.&lt;/li&gt;
&lt;li&gt;Different permutations of the same resolved input must produce the same canonical output.&lt;/li&gt;
&lt;li&gt;File declaration order within a package and root-package precedence must be preserved.&lt;/li&gt;
&lt;li&gt;The generated eager-file sequence, including the static autoload representation, must agree with the chosen compatibility policy.&lt;/li&gt;
&lt;li&gt;The generated &lt;code&gt;vendor/autoload.php&lt;/code&gt; must actually run in a fresh PHP process; comparing sets or checksums is not enough.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a Composer-compatible tool, I would add differential tests: generate the bootstrap from the same lock file using Composer and the alternative installer, compare ordered file sequences and execute both autoloaders in isolated processes. That moves the tests from internal consistency to observable compatibility.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Alphabetical ordering is useful for canonical sets and deterministic representation, particularly when an explicit string comparator makes the result independent of input permutations. However, it cannot replace a dependency graph when execution order is part of the contract. A generated artifact can be reproducible and still be wrong if its ordering violates the relationships required by its consumers.&lt;/p&gt;

&lt;p&gt;The principle I follow in tooling and framework design is simple: &lt;strong&gt;preserve semantic constraints first; make the remaining freedom deterministic second.&lt;/strong&gt; This applies equally to generated autoload artifacts, module composition plans, service provider sequences and other ordered initialization processes.&lt;/p&gt;

&lt;p&gt;If you maintain a PHP package manager, Composer plugin, framework kernel or modular application, how do you verify that your generated artifacts preserve their semantic order? I would be interested in approaches and counterexamples, especially where a valid topological order is not sufficient to match a reference implementation.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/rabbiveesh/composr/issues/2" rel="noopener noreferrer"&gt;Original report on dependency ordering in generated autoload files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://getcomposer.org/doc/04-schema.md#files" rel="noopener noreferrer"&gt;Composer schema: files autoloading&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/composer/composer/blob/main/src/Composer/Autoload/AutoloadGenerator.php" rel="noopener noreferrer"&gt;Composer AutoloadGenerator source&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/coretsia/monorepo" rel="noopener noreferrer"&gt;Coretsia framework monorepo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Disclosure: AI was used to help draft this article and prepare the example.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>composer</category>
      <category>architecture</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Designing a deterministic PHP 8.4+ framework before the first stable release</title>
      <dc:creator>Vladyslav</dc:creator>
      <pubDate>Mon, 01 Jun 2026 13:36:36 +0000</pubDate>
      <link>https://dev.to/velhbxtyrj/designing-a-deterministic-php-84-framework-before-the-first-stable-release-18m9</link>
      <guid>https://dev.to/velhbxtyrj/designing-a-deterministic-php-84-framework-before-the-first-stable-release-18m9</guid>
      <description>&lt;p&gt;This is my first post on DEV, so I want to keep it honest and technical rather than promotional.&lt;/p&gt;

&lt;p&gt;I am building Coretsia in the open, and at this stage I am mostly interested in review: unclear documentation, mismatches between code and docs, weak architectural explanations, and places where the project is harder to understand than it should be.&lt;/p&gt;

&lt;p&gt;The reason I care about this is simple: most framework problems do not appear on day one. They appear later, when conventions start drifting, documentation stops matching the code, generated files become noisy, and nobody is fully sure which rule is actually canonical.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why build another PHP framework?
&lt;/h2&gt;

&lt;p&gt;Not because PHP lacks frameworks.&lt;/p&gt;

&lt;p&gt;PHP already has mature, battle-tested frameworks and ecosystems. Laravel, Symfony, Yii, Spiral, Mezzio, CodeIgniter, and many internal company frameworks already cover a wide range of use cases. So Coretsia is not being built from the idea that the PHP ecosystem is empty.&lt;/p&gt;

&lt;p&gt;The experiment behind Coretsia is different:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Can a PHP framework be designed around deterministic tooling, strict boundaries, and source-of-truth-driven architecture from the beginning?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That question is what I am trying to explore. This does not mean that existing frameworks do not care about architecture, tooling, or boundaries. Many of them do. The question is narrower: what happens if those constraints are treated as the starting point of the framework rather than something added later by teams, conventions, or internal platform layers?&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Coretsia is actually different
&lt;/h2&gt;

&lt;p&gt;The difference is not that Coretsia wants to have routing, dependency injection, middleware, console commands, configuration, or packages. Those are expected parts of a modern PHP framework.&lt;/p&gt;

&lt;p&gt;The difference is in what the framework treats as foundation-level concerns.&lt;/p&gt;

&lt;p&gt;Coretsia starts from constraints that are often added later in projects, especially after an application has already grown:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deterministic tooling;&lt;/li&gt;
&lt;li&gt;repository and package boundary laws;&lt;/li&gt;
&lt;li&gt;source-of-truth documents for framework invariants;&lt;/li&gt;
&lt;li&gt;generated artifacts that should not drift randomly;&lt;/li&gt;
&lt;li&gt;explicit separation between runtime code, tooling, and experiments;&lt;/li&gt;
&lt;li&gt;progressive framework modes instead of one fixed application shape.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In many projects, these concerns appear later as internal platform rules, team conventions, CI scripts, architecture documents, or custom tooling. Coretsia tries to make them part of the framework model from the beginning. That does not make Coretsia more mature than existing frameworks.&lt;/p&gt;

&lt;p&gt;It makes the experiment different.&lt;/p&gt;

&lt;p&gt;Coretsia is still early. It is not production-stable. It is not something I am presenting as a replacement for existing frameworks today.&lt;/p&gt;

&lt;p&gt;I am sharing it now because this is the phase where feedback is most valuable: before the first stable release, before the public API is locked, and before the documentation structure becomes too hard to change.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Coretsia is trying to be
&lt;/h2&gt;

&lt;p&gt;Coretsia is an early-stage PHP 8.4+ framework project. Its source currently lives in a monorepo because package boundaries, tooling, documentation, generated artifacts, and release rules are part of the design.&lt;/p&gt;

&lt;p&gt;The main ideas are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deterministic tooling;&lt;/li&gt;
&lt;li&gt;strict package and architectural boundaries;&lt;/li&gt;
&lt;li&gt;explicit contracts;&lt;/li&gt;
&lt;li&gt;source-of-truth-driven documentation;&lt;/li&gt;
&lt;li&gt;reproducible generated artifacts;&lt;/li&gt;
&lt;li&gt;progressive application modes instead of one fixed application shape.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not just to assemble another routing layer, container, middleware stack, or CLI around familiar PHP application patterns. The goal is to build a framework where the structure of the project is not accidental.&lt;/p&gt;

&lt;p&gt;In many long-lived PHP applications, the problem is not that the first version was hard to build. The problem is that the system grows, and after some time nobody is fully sure where the real rule lives.&lt;/p&gt;

&lt;p&gt;Is it in code? In documentation? In a config file? In a generated artifact? In a convention that exists only in someone’s head?&lt;/p&gt;

&lt;p&gt;Coretsia tries to make those boundaries explicit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Deterministic tooling as a framework constraint
&lt;/h2&gt;

&lt;p&gt;One of the core ideas behind Coretsia is determinism. For this project, determinism does not mean “everything in runtime is magically predictable”. It means that framework tooling should avoid hidden, unstable, or environment-dependent behavior where possible.&lt;/p&gt;

&lt;p&gt;Generated files should not randomly change between runs. Ordering should be stable, configuration shapes should be explicit, tooling should be able to detect drift, and architecture checks should be repeatable.&lt;/p&gt;

&lt;p&gt;A simple example: if a tool generates an artifact from package metadata, the result should not change just because the filesystem returns files in a different order, or because the same input was processed on another machine. If the input did not change, the generated output should not create noise in Git.&lt;/p&gt;

&lt;p&gt;This matters because a framework is not only runtime code. It is also everything around the runtime:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;package layout;&lt;/li&gt;
&lt;li&gt;code generation;&lt;/li&gt;
&lt;li&gt;config merging;&lt;/li&gt;
&lt;li&gt;dependency boundaries;&lt;/li&gt;
&lt;li&gt;documentation rules;&lt;/li&gt;
&lt;li&gt;release rails;&lt;/li&gt;
&lt;li&gt;CI checks;&lt;/li&gt;
&lt;li&gt;local development commands.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If those things are unstable, the framework may still work, but the development experience slowly becomes harder to trust.&lt;/p&gt;

&lt;p&gt;Coretsia treats tooling and architecture rules as part of the framework, not as an afterthought.&lt;/p&gt;

&lt;h2&gt;
  
  
  Strict boundaries
&lt;/h2&gt;

&lt;p&gt;Another important part of the experiment is package boundaries. Coretsia is organized as a monorepo, but the monorepo is not meant to become an unstructured folder of packages.&lt;/p&gt;

&lt;p&gt;Packages are expected to have clear ownership and clear rules. The project uses layered package paths and Composer package names. It also has rules for what tooling code may or may not import.&lt;/p&gt;

&lt;p&gt;For example, development spikes and prototypes are intentionally separated from runtime packages. The goal is to make experimental tooling useful without allowing it to leak into the production runtime model.&lt;/p&gt;

&lt;p&gt;That boundary is important to me. I want prototypes to exist. I want experiments to be possible. But I do not want temporary implementation experiments to silently become framework architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  Source of Truth documents
&lt;/h2&gt;

&lt;p&gt;Coretsia also uses SSoT documents — Single Source of Truth documents — for important framework invariants. This may sound formal, but the motivation is practical.&lt;/p&gt;

&lt;p&gt;In Coretsia, these are not meant to be decorative documents. For example, packaging rules can define how a package path maps to a package id, Composer name, namespace, publishable unit, and release line. A dependency table can define allowed compile-time edges in a parse-friendly format, so tooling can check that the repository still follows the documented rule.&lt;/p&gt;

&lt;p&gt;In framework development, some rules should not be scattered across README files, tests, comments, and implementation details.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;config root ownership;&lt;/li&gt;
&lt;li&gt;artifact shapes;&lt;/li&gt;
&lt;li&gt;middleware taxonomy;&lt;/li&gt;
&lt;li&gt;observability label rules;&lt;/li&gt;
&lt;li&gt;module manifest rules;&lt;/li&gt;
&lt;li&gt;package structure rules;&lt;/li&gt;
&lt;li&gt;runtime boundaries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When these rules are important enough, they should have a canonical place. The code should follow them, the documentation should link to them, and tests or tooling should enforce them where possible.&lt;/p&gt;

&lt;p&gt;That is the direction Coretsia is moving toward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Progressive application modes
&lt;/h2&gt;

&lt;p&gt;Another idea in Coretsia is that an application should not need to start with the full enterprise shape from day one.&lt;/p&gt;

&lt;p&gt;The roadmap is structured around progressive modes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Micro;&lt;/li&gt;
&lt;li&gt;Express;&lt;/li&gt;
&lt;li&gt;Hybrid;&lt;/li&gt;
&lt;li&gt;Enterprise.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The intent is not to create marketing names for the same thing. The intent is to describe different levels of framework capability and application structure.&lt;/p&gt;

&lt;p&gt;For example, a Micro-style application should be able to stay small and direct. An Express-style application may need more framework conveniences. A Hybrid application may need clearer boundaries between application areas. An Enterprise-style application may need stronger module contracts, observability rules, package discipline, and long-term governance.&lt;/p&gt;

&lt;p&gt;Those definitions are still being refined, but the direction matters: a small service should not be forced to look like a large enterprise system. At the same time, a growing system should not require a full rewrite just because the original structure was too minimal.&lt;/p&gt;

&lt;p&gt;That is the long-term idea behind the phrase:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Start minimal. Scale to enterprise. Never rewrite.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is still a design goal, not a completed promise. The current public work is focused on the foundation needed to make that direction possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current status
&lt;/h2&gt;

&lt;p&gt;Coretsia is currently in active development. The project already has a public monorepo, roadmap, documentation, contribution files, early package structure, deterministic tooling work, CLI tooling, package compliance rails, and early framework contracts.&lt;/p&gt;

&lt;p&gt;There is no stable production release yet, so the project should be judged as an early framework foundation, not as a finished Laravel/Symfony alternative. That part is important because I do not want to present the project as more mature than it is.&lt;/p&gt;

&lt;p&gt;Right now, Coretsia is best understood as an open framework design and implementation process. Some parts are implemented, some parts are locked as project rules, some parts are still planned, and some parts still need serious review.&lt;/p&gt;

&lt;p&gt;That is exactly why I am sharing it now.&lt;/p&gt;

&lt;h2&gt;
  
  
  What kind of feedback I am looking for
&lt;/h2&gt;

&lt;p&gt;I am not looking for implementation help in this post. At this stage, I am mostly looking for review.&lt;/p&gt;

&lt;p&gt;The most useful feedback would be critical and specific.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;places where the documentation and code do not match;&lt;/li&gt;
&lt;li&gt;unclear concepts or confusing naming;&lt;/li&gt;
&lt;li&gt;roadmap parts that look overdesigned;&lt;/li&gt;
&lt;li&gt;package boundaries that do not make sense;&lt;/li&gt;
&lt;li&gt;architecture rules that are hard to understand;&lt;/li&gt;
&lt;li&gt;missing explanations for first-time readers;&lt;/li&gt;
&lt;li&gt;places where the README assumes too much context;&lt;/li&gt;
&lt;li&gt;problems in the local setup flow;&lt;/li&gt;
&lt;li&gt;weak spots in the contribution model;&lt;/li&gt;
&lt;li&gt;parts of the framework idea that are not convincing yet.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am especially interested in feedback from people who have maintained long-lived PHP systems, not only built greenfield applications. I am interested in the kind of feedback that comes from maintaining code after the first version is already shipped.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I am not looking for
&lt;/h2&gt;

&lt;p&gt;I am not looking for “please add this feature” requests yet. I am not asking for production adoption.&lt;/p&gt;

&lt;p&gt;I am not trying to start a framework war. I am not presenting Coretsia as “better than Laravel” or “better than Symfony”.&lt;/p&gt;

&lt;p&gt;That is not the point.&lt;/p&gt;

&lt;p&gt;The point is to explore a different framework design constraint:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if deterministic tooling, explicit boundaries, and source-of-truth architecture were part of the framework from the beginning?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Website and visual direction
&lt;/h2&gt;

&lt;p&gt;Coretsia already has a small public website. At the moment, it is intentionally minimal: a landing page and a privacy/cookie page. It exists so the project has a public surface, basic positioning, links to the monorepo, roadmap, documentation, and a way for people to contact the project.&lt;/p&gt;

&lt;p&gt;But I do not consider the current website to be the final form of Coretsia’s public identity. It was built early, before the framework story, documentation structure, and visual direction were fully clear. That was useful, because it gave the project a real website instead of waiting for the “perfect” version.&lt;/p&gt;

&lt;p&gt;The next version of the website should become a better explanation layer for the framework. It should help a first-time visitor understand what Coretsia is, what is implemented, what is still planned, why the project exists, and where to start reading.&lt;/p&gt;

&lt;p&gt;I am also interested in ideas for the future website: homepage structure, documentation navigation, visual direction, roadmap presentation, and ways to explain Micro / Express / Hybrid / Enterprise modes without making the project look like a generic SaaS landing page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why share this now?
&lt;/h2&gt;

&lt;p&gt;Because early-stage architecture is easiest to improve before it becomes stable. Once a project has a stable release, public API, documentation structure, package layout, and community expectations, every change becomes more expensive.&lt;/p&gt;

&lt;p&gt;Right now, Coretsia is still in the phase where review can actually change the direction. That is why I would rather ask for criticism now than polish the surface too early.&lt;/p&gt;

&lt;p&gt;A good review at this stage is more valuable than a star.&lt;/p&gt;

&lt;p&gt;A found mismatch between code and documentation is more valuable than a generic compliment. A clear objection to an architectural decision is more useful than vague encouragement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub organization: &lt;a href="https://github.com/coretsia" rel="noopener noreferrer"&gt;https://github.com/coretsia&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Framework monorepo: &lt;a href="https://github.com/coretsia/monorepo" rel="noopener noreferrer"&gt;https://github.com/coretsia/monorepo&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Website repository: &lt;a href="https://github.com/coretsia/website" rel="noopener noreferrer"&gt;https://github.com/coretsia/website&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Website Design RFC: &lt;a href="https://github.com/coretsia/monorepo/discussions/categories/design-rfc" rel="noopener noreferrer"&gt;https://github.com/coretsia/monorepo/discussions/categories/design-rfc&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have experience with PHP frameworks, long-lived PHP applications, internal platforms, package architecture, documentation, or developer tooling, I would appreciate a critical look.&lt;/p&gt;

&lt;p&gt;If you notice something specific, a comment is useful. If the feedback is about the broader direction, the Design RFC discussion is the best place for it. If it is a concrete mismatch in the repository, opening an issue would also be useful.&lt;/p&gt;

&lt;p&gt;Not because Coretsia is finished.&lt;/p&gt;

&lt;p&gt;Because it is not finished yet.&lt;/p&gt;

</description>
      <category>php</category>
      <category>architecture</category>
      <category>opensource</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
