Skip to content

Commit d3337e4

Browse files
Documents mago. Adds more packages.
1 parent d213021 commit d3337e4

2 files changed

Lines changed: 41 additions & 5 deletions

File tree

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ ARG MONGODB_VERSION="latest"
4444
ENV COMPOSER_HOME="/composer"
4545
ENV COMPOSER_CACHE_DIR="$COMPOSER_HOME/cache"
4646
ENV COMPOSER_BIN_DIR="$COMPOSER_HOME/bin"
47-
ENV COMPOSER_PACKAGES="laravel/installer laravel-zero/installer vildanbina/composer-upgrader nunomaduro/phpinsights pestphp/pest-plugin laravel/pail rector/rector"
47+
ENV COMPOSER_PACKAGES="laravel/installer laravel-zero/installer vildanbina/composer-upgrader ion-bazan/composer-diff nunomaduro/phpinsights laravel/pail rector/rector ergebnis/composer-normalize maglnet/composer-require-checker icanhazstring/composer-unused psy/psysh deptrac/deptrac"
4848
ENV COMPOSER_RUNTIME_PACKAGES=""
49+
ENV MAGO_INSTALL="true"
4950

5051
ENV PATH=$PATH:$COMPOSER_BIN_DIR:$COMPOSER_HOME/vendor/bin
5152

@@ -369,8 +370,9 @@ RUN \
369370
# For more info: https://mago.carthage.software/tools/formatter/configuration-reference
370371
#
371372
RUN \
372-
if php -r "exit(version_compare(PHP_VERSION, '8.1.0', '>=') ? 0 : 1);"; then \
373-
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash; \
373+
if php -r "exit(version_compare(PHP_VERSION, '8.1.0', '>=') ? 0 : 1);" && \
374+
[[ "$MAGO_INSTALL" =~ ^(true|TRUE|1)$ ]]; then \
375+
curl --proto '=https' --tlsv1.2 -sSf https://carthage.software/mago.sh | bash; \
374376
fi
375377

376378
#

README.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ This PHP image for development is re-built every Tuesday and Thursday at 07:00 U
4141
This image includes everything to run in your development environment and then some.
4242

4343
- [Composer](https://getcomposer.org/)
44+
- [Mago](https://mago.carthage.software/)
4445
- [XDebug](https://xdebug.org/)
4546
- [Swoole](https://swoole.com/)
4647
- [PHP Extension installer](https://github.com/mlocati/docker-php-extension-installer)
@@ -95,7 +96,7 @@ If you're using a DevContainer through a Docker Compose file, set the image to b
9596
services:
9697

9798
app-dev:
98-
image: laragear/php:8.3
99+
image: laragear/php:8.5
99100
extra_hosts:
100101
- 'host.docker.internal:host-gateway'
101102
# ...
@@ -131,7 +132,30 @@ Because these extensions are installed at runtime, the container may take a whil
131132
>
132133
> For example, installing `sqlsrv` on `php:7.4` won't work, as it will install the latest `v5.12.0`. Instead, you will need to set the proper version that supports PHP 7.4, as `sqlsrv:5.10.1`. You can see supporting versions of each extension at [PECL](https://pecl.php.net/).
133134
134-
## Composer Cache
135+
## Composer
136+
137+
This container includes Composer, but also some useful composer plugins and global packages for your development convenience:
138+
139+
* [`laravel/installer`](https://laravel.com/docs/13.x/installation#creating-a-laravel-project): A command-line tool that lets you create fresh Laravel projects instantly.
140+
* [`laravel-zero/installer`](https://laravel-zero.com/): The entry point for creating lightweight, modular command-line applications using the foundations of Laravel.
141+
* [`vildanbina/composer-upgrader`](https://github.com/vildanbina/composer-upgrader): Helps you interactively update your dependencies to their latest versions, making the chore of keeping `composer.json` current much easier.
142+
* [`ion-bazan/composer-diff`](https://github.com/IonBazan/composer-diff): Generates a clear, human-readable comparison of what changed in your `composer.lock` file after an update (e.g., which packages moved from version 1.1 to 1.2).
143+
* [`nunomaduro/phpinsights`](https://github.com/nunomaduro/phpinsights): A comprehensive analysis tool that gives you a "score" for your code quality, complexity, and architecture, along with tips to improve it.
144+
* [`laravel/pail`](https://laravel.com/docs/12.x/logging#tailing-log-messages-using-pail): A tool that allows you to easily "stream" your Laravel application logs directly to your terminal, making real-time debugging much cleaner.
145+
* [`rector/rector`](https://github.com/rectorphp/rector): An automated refactoring tool that can instantly upgrade your code from old PHP versions to new ones or fix deprecated code patterns across your whole project.
146+
* [`ergebnis/composer-normalize`](https://github.com/ergebnis/composer-normalize): Automatically cleans up and standardizes the structure of your `composer.json` file (sorting entries alphabetically, fixing whitespace, etc.).
147+
* [`maglnet/composer-require-checker`](https://github.com/maglnet/ComposerRequireChecker): Checks your code to make sure you aren't using a library that you forgot to actually list in your `composer.json` file.
148+
* [`icanhazstring/composer-unused`](https://github.com/composer-unused/composer-unused): Scans your project to find packages that are listed in your `composer.json` but are no longer actually being used in your code.
149+
* [`psy/psysh`](https://psysh.org/): A powerful interactive debugger and REPL (Read-Eval-Print Loop) for PHP that lets you test snippets of code and explore variables in real-time.
150+
* [`deptrac/deptrac`](https://deptrac.github.io/deptrac/): A tool that helps you visualize and enforce architectural rules, making sure (for example) that your database layer doesn't accidentally depend on your visual templates.
151+
152+
All of these libraries and binaries are available globally inside the container.
153+
154+
```shell
155+
docker run --rm -it laragear/php laravel new my-app
156+
```
157+
158+
### Composer Cache
135159

136160
The composer cache is located at `/composer/cache`. You can mount your host Composer Cache, which should make the dependencies installation and updating _faster_ if you're running a lot of Composer projects with a common cache.
137161

@@ -141,6 +165,16 @@ docker run laragear/php \
141165
composer install
142166
```
143167

168+
## Mago
169+
170+
Instead of installing PHP-CS-Fixer, Laravel Pint, and PHP_CodeSniffer, [Mago replaces all of these tools](https://mago.carthage.software/). What's best, it that was coded in Rust, so it's 80x–90x times faster.
171+
172+
Mago is installed automatically and can be run in the container:
173+
174+
```shell
175+
docker run --rm -it laragear/php mago analyze
176+
```
177+
144178
## Custom User & Group ID
145179

146180
The default user for the container is `developer`, which is mapped as `1000:1000`.

0 commit comments

Comments
 (0)