blemli / partysan
stop wishing and start building
Fund package maintenance!
Requires
- php: ^8.4
- illuminate/contracts: ^11.0||^12.0||^13.0
- joshembling/artisan-browse: ^0.0.7
- laravel/prompts: ^0.3.15
- spatie/laravel-package-tools: ^1.16
- vlucas/phpdotenv: ^5.6
Requires (Dev)
- larastan/larastan: ^3.0
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^11.0.0||^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan-deprecation-rules: ^2.0
- phpstan/phpstan-phpunit: ^2.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
stop wishing and start building
Frequently I find myself thinking "it would be nice if an artisan command existed for this". This package solves that problem by adding hundreds of missing artisan commands. More in sight: Keep the PR's coming!
Installation
composer require blemli/partysan --dev
Usage
just run php artisan browse and have fun.
Commands
audit, browse, dependency:switch, db:create, open, rename
audit
Check everything the app is built on for known vulnerabilities (CVEs) and for runtimes that no longer get security fixes, with one command:
php artisan audit # composer, npm, docker images and end-of-life runtimes php artisan audit --critical # only critical vulnerabilities php artisan audit --high # high and critical (also --medium, --low, --severity=high) php artisan audit --fix # update the affected composer and node packages, then audit again php artisan audit --high --fix # ...but only those with a high or critical finding php artisan audit --no-dev # leave out development dependencies php artisan audit --only=composer,npm php artisan audit --without=docker php artisan audit --ignore=CVE-2026-0001 # accept a finding for a week, then audit php artisan audit --path=../my-package # audit another directory, e.g. a package checkout php artisan audit --json # machine-readable, e.g. for CI php artisan audit -v # also print the advisory links
| scanner | what it audits | tool |
|---|---|---|
composer |
composer.lock (or the installed packages when there is no lockfile) |
composer audit |
npm |
the lockfile of whichever package manager the project uses | npm audit, pnpm audit, yarn audit / yarn npm audit, bun audit |
docker |
the base images of every Dockerfile (all build stages, ARG defaults filled in), the images of compose services and of kamal accessories, plus audit.docker.images from the config |
trivy, grype or docker scout, whichever is installed first |
eol |
whether the release of PHP, Laravel, Node, the database server of the default connection and every docker image tag (php:8.3-fpm, postgres:16, node:22-alpine, ...) is past its end of life |
endoflife.date |
A scanner only runs when the project uses its technology. The command exits with 1 when a vulnerability is reported or when something could not be audited (a tool that is not installed, an image that cannot be pulled, no network), so a broken check never looks like a clean one; skip a scanner on purpose with --without.
--severity (or audit.severity in the config) sets the lowest severity that is reported and fails the command; what stays below it is only counted. Advisories without any severity, which composer audit produces for some sources, are shown by default and hidden as soon as a threshold is set.
--fix updates the packages behind the reported findings and nothing else, so it honours the severity filter and the ignore list: --high --fix leaves a package with only a medium finding alone. It runs composer update <packages> --with-dependencies and the update command of the node package manager (npm update, pnpm update, yarn upgrade / yarn up, bun update), both within the version constraints of composer.json and package.json, then audits again and reports what is left. A finding that needs a new major version stays and has to be resolved by hand; docker images and end-of-life runtimes cannot be fixed automatically either.
Docker images are scanned side by side, four at a time (audit.docker.concurrency), with a progress bar. The first scan of an image is slow because the scanner has to download it; later runs use the scanner's own cache. When docker scout cannot read the local copy of an image it is scanned from the registry instead.
The eol scanner reports a release that is past its end of life as high, and as low during the last 90 days before it (audit.eol.warn_days). PHP, Node and the database server are the ones this machine runs and reaches, which is not necessarily what production runs; the image tags describe what gets deployed. Tags that name no release (latest, a bare major like php:8) cannot be judged and are left out. It makes one request per product to endoflife.date and sends nothing about the app.
--ignore=<id>[,<id>] records the ids from the ID column in .audit-ignore.json in the project root and keeps them quiet for 7 days (audit.ignore.days), after which they are reported again by themselves. Ignored findings are listed on every run and do not fail the command. Commit the file so the team and CI share the decision; delete a line to end it early.
--path=<dir> audits another directory instead of the app, which is how a package that has no artisan of its own gets audited: run the command from any app that has partysan installed. The path is relative to the current working directory (~ works), and the ignore list is read from and written to that directory. A package without a committed composer.lock is audited by its installed vendor directory, so run composer install there first. Only point --path at code you trust as much as you would to run npm install in it: the package managers are started inside that directory and honour its configuration (.npmrc, .yarnrc.yml with its yarnPath, .pnpmfile.cjs), which can run code from it. Composer is started without plugins and scripts. With --path the eol scanner takes the Laravel version from that directory's composer.lock and leaves the database out, since both would otherwise describe the app running the command.
Images that the project builds itself (a compose service with build:, the kamal image:) are not scanned directly; their base images are. Add the image you ship to audit.docker.images to scan the final result too. Images whose name depends on a variable without a default are skipped with a warning.
Anything else can be hooked in as a scanner: implement Blemli\Partysan\Audit\AuditScanner and register it in config/partysan.php under audit.scanners, or from a service provider:
app(\Blemli\Partysan\Partysan::class)->auditScanner(MyRuntimeScanner::class);
db:create
Create the database for a connection if it does not exist yet. Supports all first-party Laravel drivers: sqlite, mysql, mariadb, pgsql and sqlsrv.
# create the database of the default connection php artisan db:create # create a specific database on a specific connection php artisan db:create my_database --connection=pgsql # mysql/mariadb charset & collation (defaults to the connection config) php artisan db:create --charset=utf8mb4 --collation=utf8mb4_unicode_ci # use a privileged account when the app user may not create databases php artisan db:create --admin-user=root # skip the confirmation prompt in production php artisan db:create --force
For sqlite the database file (including missing parent directories) is created. For the server drivers the command connects to the server's maintenance database (postgres for pgsql, master for sqlsrv) with the connection's credentials — or the given admin credentials — and issues a CREATE DATABASE if it is missing.
open
Open the app in your browser (also available as visit):
# open the current APP_URL (config('app.url')) php artisan open # open the APP_URL from .env.production php artisan open --env=production
With --env=<environment> the URL is read directly from .env.<environment> in the project root, so it works even when the config is cached. Fails with a clear error if the file does not exist or has no APP_URL.
rename
Rename the app everywhere at once and get told about everything that is left:
php artisan rename "New App" # old name is read from APP_NAME php artisan rename new-app --from="Old App" # when APP_NAME, directory and composer name disagree php artisan rename "New App" --dry-run # show what would happen php artisan rename "New App" --only=env,composer php artisan rename "New App" --without=github,directory php artisan rename --plugins # list plugins and whether they apply here
Every spelling is handled: My App, MyApp, my-app, my_app, myapp, MY_APP and my app each become the matching spelling of the new name, matched as whole words only (art never touches artisan, but MyAppServiceProvider becomes NewAppServiceProvider).
The command requires a clean git working tree (so git checkout . undoes the file changes) unless --force is given, and runs these plugins in order:
| plugin | what it does |
|---|---|
env |
rewrites the name in every .env* file: APP_NAME and derived values like DB_DATABASE, APP_URL, SESSION_COOKIE, VITE_APP_NAME |
composer |
name, description and repository URLs (homepage, support.*, repository, bugs) in composer.json, package.json and package-lock.json, without reformatting them |
readme |
rewrites the README title when it is nothing but the old name; other mentions are left to scan |
namespace |
renames the root PHP namespace when it is not the default App, then runs composer dump-autoload |
kamal |
config/deploy*.yml and everything under .kamal/ (service, image, hosts, volumes, secrets) |
compose |
docker compose files; warns that compose derives container and volume names from the directory, with the commands to pin the project name or copy the volumes |
1password |
lists items whose title or URL carries the name as a checkbox list (all ticked; untick what should keep its name) and renames the selected ones via the op CLI; skipped when op is missing or signed out |
forge |
with a FORGE_API_TOKEN: renames matching Forge sites (domain, git repository, remote .env, deployment script) |
ide |
PhpStorm .idea/.name, .idea/<name>.iml plus modules.xml, and VS Code <name>.code-workspace files, which are gitignored and therefore invisible to scan |
github |
gh repo rename, then makes sure the local origin remote points at the new URL |
scan |
lists every remaining occurrence in tracked and untracked files (any casing) with line numbers, then shows the files as a checkbox list (all ticked; untick what must keep the old name, ctrl+a toggles all) with a syntax-coloured preview of the highlighted file's matching lines plus one line of context underneath; --force and --no-interaction take the default and replace everything, --dry-run only reports; same for files and directories whose name carries the old name |
caches |
config:clear, route:clear, view:clear, event:clear, clear-compiled so bootstrap/cache and compiled views forget the old name and path |
directory |
renames the project directory and prints the cd to run |
herd |
with Herd or Valet installed: a linked site is unlinked and linked again from the renamed directory; a parked site follows the directory name by itself. Either way, if herd secured listed the old site it is secured again, and an isolated PHP version (herd isolated) is isolated again under the new name |
Finally a checklist of things it cannot do safely is printed: the database itself (mysql has no RENAME DATABASE; run db:create and migrate), kamal containers and volumes on the servers, the session cookie name (everyone is logged out), cache and queue prefixes (drain queues first), processes still running from the old directory, DNS and TLS, OAuth callback URLs, monitors, registries, IDE project files, binary assets and hosting dashboards such as Laravel Cloud.
Rename plugins
Anything else that knows your app by name can be hooked in as a plugin. Implement Blemli\Partysan\Rename\RenamePlugin (or extend BasePlugin) and register it either in config/partysan.php under rename.plugins, or from a service provider:
app(\Blemli\Partysan\Partysan::class)->renamePlugin(MyRegistryPlugin::class);
A plugin gets a RenameContext with the old and new AppName (all spellings, replaceIn(), matches()), dry-run aware helpers (replaceInFile(), put(), move(), run()), confirm() and choose() (a checkbox list) that honour --force/--no-interaction/--dry-run, record() for the change log and remind() for the final checklist. order() decides when it runs (built-ins: 10 env, 20 composer, 25 readme … 900 scan, 950 caches, 1000 directory, 1010 herd; plugins after the move read $context->currentPath()) and applies() lets it skip projects it does not concern. Plugins are addressed by key() in --only/--without.
dependency:switch
Switch a composer dependency between local symlink, VCS (git) and Packagist sources:
php artisan dependency:switch # interactive php artisan dependency:switch vendor/package --local # symlink a local checkout php artisan dependency:switch vendor/package --vcs # use a git repo/branch php artisan dependency:switch vendor/package --packagist # reset to Packagist php artisan dependency:switch --list # list dependencies and their source
--list prints every dependency with its current mode, branch and PR status. The PR column is looked up via gh for switched packages only, so the listing stays fast; it is left empty when gh is unavailable. Combine --list with --local, --vcs or --packagist to filter by source, and with --transitive to include transitive dependencies.
