Sign inSign up

universityofabdn/docker-php74-workspace

By universityofabdn

•Updated over 5 years ago

Image
0

364

universityofabdn/docker-php74-workspace repository overview

This is a PHP 7.4.12 Docker Image containing development tools. It should be used alongside uofa/docker-php74.

The following are available globally:

  • composer (2.0.6)
  • git (1.8.3.1)
  • phpcs and phpcbf⁠
  • Easy Coding Standards⁠ - the Easiest Way to Use Any Coding Standard
  • PHPCompatibility⁠ - checks for PHP cross-version compatibility. It will allow you to analyse your code for compatibility with higher and lower versions of PHP)
  • VariableAnalysis⁠ - Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use
  • npm (6.14.8)
  • nodejs (v10.23.0)
  • gulp (4.0.2)
  • rector⁠ - instant upgrades and instant refactoring of any PHP 5.3+ code
  • phan⁠ - static analysis tool - Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness
  • phpstan⁠ - static analysis tool - the unique feature of PHPStan is the ability to define and statically check "magic" behaviour of classes
  • envoy⁠ - provides a clean, minimal syntax for defining common tasks you run on your remote servers.
  • git-ftp⁠ - can save you some time and bandwidth by uploading only those files that changed since the last upload

⁠Usage:

Update your docker-compose.yml with:

workspace:
  image: universityofabdn/docker-php74-workspace

Open a bash terminal into the container:

docker exec -it <***-workspace_1> bash
# create a package.json 
npm init
⁠Example: Updating a codebase to PHP 7.3

To quickly detect deprecated code run phpcs:

phpcs -p myapp --standard="PHPCompatibility" --runtime-set testVersion 7.4

To quickly detect problematic variable use:

phpcs -p myapp --standard="VariableAnalysis"

For a more in depth analysis, and automated refactor, use Rector:

rector process myapp --set php74 --dry-run

# e.g. for scanning the Laravel app directory
rector process laravel/app --set php74 --dry-run --autoload-file laravel/vendor/autoload.php

The --dry-run parameter will highlight the intended changes. In order to automatically refactor your code, run the same command without --dry-run

rector process myapp --set php74

Additional checks can be mande using PHPStan

phpstan analyse -l 1 myapp

# e.g. for scanning the Laravel app directory
phpstan analyse -l 1 laravel/app --autoload-file=laravel/vendor/autoload.php

The -l parameter enables incremental adoption of PHPStan checks (1 to 7, where 7 is the strictest).

Running Easy Coding Standards:

Note, you will need to have a copy of the ECS ruleset in your repo before this can be run. The version in Laravel Starter⁠ can be used.

# runs the standards set in ecs.yaml
ecs check myapp 
ecs check myapp --fix

Tag summary

Content type

Image

Digest

Size

1.3 GB

Last updated

over 5 years ago

docker pull universityofabdn/docker-php74-workspace