Skip to content

Commit 643bf07

Browse files
authored
Update documentation (#62)
1 parent 6b8b4dc commit 643bf07

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ help:
1616

1717
build: ## Build the PHAR
1818
build: vendor
19+
# Cleanup existing artefacts
1920
rm -f bin/php-scoper.phar
2021
rm -rf build
22+
# Delete local `composer.lock` to ensure fresh dependencies are used
2123
rm composer.lock
2224
#
2325
# As of now, files included in `autoload-dev` are not excluded from the
@@ -28,10 +30,11 @@ build: vendor
2830
# As a result, the the flag `--no-dev` for `composer install` cannot
2931
# be used and `box.json.dist` must include the `tests` directory
3032
#
31-
composer install --prefer-dist --classmap-authoritative
33+
composer install --prefer-dist
3234
php -d zend.enable_gc=0 bin/php-scoper.php add-prefix --force
3335
cd build && composer dump-autoload --classmap-authoritative
3436
php -d zend.enable_gc=0 $(BOX) build
37+
# Install back all the dependencies
3538
composer install
3639

3740

README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,41 @@ the vendors of the loaded project, if the vendors are required in incompatible
2525
versions.
2626

2727

28-
## Usage
28+
## Installation
2929

30-
Use PHP-Scoper like this:
30+
You can install PHP-Scoper with Composer:
3131

32+
```bash
33+
composer global require humbug/php-scoper:dev-master
3234
```
33-
$ php-scoper add-prefix MyPhar\\ .
35+
36+
If you cannot install it because of a dependency conflict or you prefer to
37+
install it for your project, we recommend you to take a look at
38+
[bamarni/composer-bin-plugin][bamarni/composer-bin-plugin]. Example:
39+
40+
```bash
41+
composer require --dev bamarni/composer-bin-plugin
42+
composer bin php-scoper require --dev humbug/php-scoper:dev-master
3443
```
3544

36-
The first argument is the prefix to add to all namespace declarations and class
37-
usages. The second argument is one or more files/directories which should be
38-
processed.
45+
A PHAR should be availaible soon as well.
46+
47+
48+
## Usage
49+
50+
```bash
51+
php-scoper add-prefix
52+
```
53+
54+
This will prefix all the files found in the current working directory.
55+
The prefixed files will be accessible in a `build` folder. You can
56+
then use the prefixed code to build your PHAR.
57+
58+
**Warning**: After prefexing the files, if you are relying on Composer
59+
for the autoloading, dumping the autoloader again is required.
60+
61+
For a more concrete example, you can take a look at PHP-Scoper's build
62+
step in [Makefile](Makefile).
3963

4064

4165
## Contributing
@@ -52,3 +76,4 @@ Project originally created by: [Bernhard Schussek] ([@webmozart]) which has then
5276
[Bernhard Schussek]: https://webmozart.io/
5377
[@webmozart]: https://twitter.com/webmozart
5478
[humbug]: https://github.com/humbug
79+
[bamarni/composer-bin-plugin]: https://github.com/bamarni/composer-bin-plugin

0 commit comments

Comments
 (0)