tobya / work-with-composer
Work-with-composer provides a basic set of tools for working with local repositories
Fund package maintenance!
Requires
- php: ^8.1
- illuminate/contracts: ^11.0||^12.0||^13.0
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- 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
- spatie/laravel-ray: ^1.35
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
A set of simple tools to allow easy swapping in of local and production repositories. This is very useful when you are working on a package in conjunction with an app. Previously created local links are stored so that future application can be simply selected.
Installation
You can install the package via composer:
composer require tobya/work-with-composer
You can publish the config file with:
php artisan vendor:publish --tag="work-with-composer-config"
Ideally .gitignore your work-with-composer.json file, as this will be different on each dev machine.
# .gitignore
work-with-composer.json
Usage
Add a new local repository
$ php artisan wwcomposer:add-local Package Name eg. tobya/QueueStatus: ❯ tobya/queuestatus Full Local Directory Path: ❯ C:\Development\github\queuestatus All done - Local Repo for tobya/queuestatus has been created. Don't forget to composer require your package Composer require tobya/queuestatus Do you wish to run it now? (yes/no) [no]: > yes ./composer.json has been updated Running composer update tobya/queuestatus Loading composer repositories with package information
Restore a repository to the production version before publishing your app.
php artisan wwcomposer:restore-production Which repository do you want to restore?: [0] tobya/work-with-composer [1] tobya/bcsapiwrapper [2] tobya/queuestatus > 2 2 Repository restored: tobya/queuestatus dev-main Don't forget to composer require your package Composer require tobya/queuestatus Do you wish to run composer require now? (yes/no) [no]: >
Restore a previously set up local repository for development
php artisan wwcomposer:restore-local Which repository do you want to restore?: [0] tobya/work-with-composer [1] tobya/bcsapiwrapper [2] tobya/queuestatus > 0 0 All done - Local Repo for tobya/work-with-composer has been created. Don't forget to composer require your package Composer require tobya/work-with-composer Do you wish to run it now? (yes/no) [no]: > yes
List all Local Repositories
php artisan wwcomposer:list-local
Composer Errors
Sometimes things get out of whack and you will get an error from composer saying everything is skew ways. This can
usually be fixed very easily by taking a step back and running composer update
Notes
Work with Composer modifies your composer.json file. It does this by reading, modifying and writing the file. Unfortunately this does not preserve white space etc. If you do not like something messing with your composer.json file you probably shouldn't use this package.
The package stores the version of a package that was set when the local version is provided. When restored this 'last_known_version' is restored.
Contributions
I have found this package very helpful to allow me to quickly attach and detach a development package to an app I am developing in tandem with it. The package is in development and I am slowly adding the bits that make sense for me. I would be delighted in feedback in the form of issues or help in the form of PRs. We could make wwcomposer the standard for laravel based composer manipulation.
Testing
composer test
Credits
License
The MIT License (MIT). Please see License File for more information.