hichemtab-tech / pomposer
A smarter Composer wrapper for global caching, shared dependencies, and efficient package management across PHP projects.
Fund package maintenance!
Buy Me A Coffee
hichemtab-tech
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 10
Watchers: 0
Forks: 1
Open Issues: 0
Type:project
Requires
- php: ^8.2
- ext-zip: *
- composer/semver: ^3.4
- illuminate/filesystem: ^10.20|^11.0|^12.0
- illuminate/support: ^10.20|^11.0|^12.0
- laravel/prompts: ^0.1.18|^0.2.0|^0.3.0
- symfony/console: ^6.2|^7.0
- symfony/filesystem: ^7.3
- symfony/polyfill-mbstring: ^1.31
- symfony/process: ^6.2|^7.0
Requires (Dev)
- pestphp/pest: 3.8.2
- phpstan/phpstan: ^2.1
- phpunit/phpunit: 11.5.15
This package is auto-updated.
Last update: 2025-07-09 09:34:43 UTC
README
A blazing-fast, cache-aware Composer wrapper that shares packages globally between PHP projects β inspired by pnpm
.
Why Pomposer?
Composer is the backbone of modern PHP development, but it's not optimized for shared storage.
Every composer install
duplicates packages per project, eating up disk space and time.
Pomposer brings the best of pnpm
to PHP:
- π¦ Global Package Store: Each package version is downloaded and stored only once.
- β‘ Faster Installs: Once a package is in the global store, installs are nearly instant.
- βοΈ Advanced Autoloader: Generates a complete, optimized autoloader (PSR-4, classmap, files).
- π€ Framework Compatibility: Creates the necessary manifests (
installed.json
, etc.) for features like Laravel's package auto-discovery. - π Script Execution: Correctly runs
post-install-cmd
andpost-autoload-dump
scripts.
How It Works
- Read
composer.lock
(or falls back tocomposer.json
with its own resolver). - Download and cache packages to the global store at
~/.pomposer-store
. - Read the full
composer.json
from within each package to gather all metadata (autoloading rules, scripts, and framework providers). - Generate a complete vendor directory, including:
- An optimized classmap and PSR-4 autoloader pointing to the global store.
- The full package manifest (
installed.json
,installed.php
, etc.) for framework compatibility. - Compatibility stubs for Composer's internal classes.
- Execute post-install scripts to finalize the installation (e.g.,
php artisan package:discover
).
Installation
You can install Pomposer globally or locally via Composer:
composer global require hichemtab-tech/pomposer
Make sure Composer global bin is in your $PATH
. Then run:
pomposer install
Example 1: Build a small Project with Pomposer
Letβs test Pomposer using a simple PHP app that:
- Uses
monolog/monolog
for logging - Uses your custom package
hichemtab-tech/namecrement
- Has its own PSR-4 autoloading
1. Create your test project
mkdir test-pomposer && cd test-pomposer
2. Create a composer.json
:
{ "name": "hichemtab-tech/test-pomposer", "autoload": { "psr-4": { "HichemTabTech\\TestPomposer\\": "src/" } }, "authors": [ { "name": "HichemTab-tech", "email": "konanhichemsinshi@gmail.com" } ], "require": { "hichemtab-tech/namecrement": "^1.1", "monolog/monolog": "^3.9" } }
3. Create your source and test files
mkdir src touch src/index.php
Then edit src/index.php
:
<?php require_once __DIR__ . '/../vendor/autoload.php'; use HichemTabTech\Namecrement\Namecrement; use Monolog\Logger; use Monolog\Handler\StreamHandler; $existing = ['file', 'file (1)', 'file (2)']; $newName = Namecrement::namecrement('file', $existing); echo "Next unique file name after the list of existing files:\n"; echo "Existing files: " . implode(', ', $existing) . "\n"; echo "New file name: "; echo $newName . "\n\n"; $log = new Logger('test'); $log->pushHandler(new StreamHandler('php://stdout', Logger::DEBUG)); $log->info('Pomposer is alive!');
4. Run Pomposer
pomposer install
It will:
- Resolve dependencies (even if no
composer.lock
) - Download and cache each package version in
~/.pomposer-store
- Link the necessary packages into your
vendor/
folder - Generate a working autoloader
5. Run the test script
php src/index.php
β You should see output like:
Next unique file name after the list of existing files:
Existing files: file, file (1), file (2)
New file name: file (3)
[2025-07-06 20:31:22] test.INFO: Pomposer is alive! []
β
You just installed monolog/monolog
without Composer touching your vendor/
at all.
Example: Building a Real Laravel App with Pomposer
We have adapted Pomposer to install and run a modern Laravel application. This process served as a practical test of its ability to handle complex dependencies, package auto-discovery, and post-install scripting.
1. Create a Laravel Project
First, create a standard Laravel project with a starter kit like Breeze.
using Laravel Installer
# Example using Laravel Breeze with React & SSR laravel new pomposer-test-app --breeze --stack react --ssr cd pomposer-test-app
or using LaravelFS Installer
laravelfs new pomposer-test-app --breeze --stack react --ssr
cd pomposer-test-app
2. Remove Existing Vendor Directory
We want to install from scratch using only Pomposer.
rm -rf vendor composer.lock
3. Run Pomposer
Now, tell Pomposer to handle the installation.
pomposer install
Pomposer will resolve dependencies, use its global cache, generate the autoloader and package manifests, and correctly run php artisan package:discover as part of its script execution.
4. Verify It Works
Once the installation is complete, you can run standard Artisan commands. The application is ready to go.
php artisan about
You will see a complete list of environment details and discovered packages (like Inertia), proving that Laravel has booted successfully using the Pomposer-generated vendor directory.
Global Store Layout
Packages are stored by name + version:
βββ ~/.pomposer-store/
βββ hichemtab-tech
β βββ namecrement
β βββ 1.1.0
β βββ composer.json
β βββ src
βββ monolog
β βββ monolog
β βββ 3.9.0
β βββ composer.json
β βββ src
βββ psr
βββ log
βββ 3.0.2
βββ composer.json
βββ src
β οΈ Limitations (Beta Notice)
Warning
Pomposer is still in beta β built as a proof of concept.
Current limitationsΒ :
- β οΈ No Symlinking: Unlike pnpm, Pomposer does not use symlinks. It generates an autoloader that points directly to the global store. This means the
vendor/
directory is mostly empty, which can break tools or build scripts that expect to find physical files there. - β οΈ Basic Dependency Resolver: The dependency resolver is simple and may fail on complex version constraints. It works best when a
composer.lock
file is present. - β No Support for
provide
/replace
/conflict
: These advanced dependency management rules are not implemented. - β No Composer Plugin System: Cannot run Composer plugins.
- β οΈ Limited Autoloading: Does not support the deprecated
psr-0
standard.
π‘ Want to Contribute?
Got ideas or experience with Composer internals? Want to help evolve Pomposer into something production-ready?
π Join the discussion and contribute on GitHub: #4
License
MIT Β© @HichemTab-tech