Continuous Integration, Deployment, and Reviews for PHP¶
Scrutinizer supports all dependency managers that help PHP developers use during development. For static analysis, Scrutinizer has developed the most advanced static analysis engine that is available for PHP code going beyond simple style checks like whether you are using certain language features in your code. We track how data flows through your application to detect security issues, bugs, unused code, and a lot more.
Generally, we infer most of the configuration based on your project if you follow common best practices. Where this fails,
you can also adjust Scrutinizer's behavior to your needs through configuration. We recommend that you place test related
commands in a
.scrutinizer.yml file while keeping environment variables that contain sensitive data and analysis
related configuration in your repository configuration on the website, or in also in your organization configuration
(see our configuration best practices).
Scrutinizer supports several PHP versions. We try to infer your preferred PHP version
and will fall back to
5.6 if we are not sure. If you would like to define a specific PHP version, you
can set it in your configuration:
build: environment: php: version: 7.2 # Common versions: 5.4, 5.5, 5.6, 7.0, 7.1, 7.2, or hhvm
Please contact us if you need a version that we do not support yet, we will be happy to install it for you.
We use the default development php.ini with some tweaks. Should you like to modify ini settings, you can specify these in your configuration file, and we will automatically populate your ini files with these:
build: environment: php: version: '7.0' ini: 'date.timezone': 'US/Pacific'
Typically, you will want to install your dependencies through
composer. If you have placed a
in your project, we will automatically run the necessary commands for you. We will also infer possible PHP extensions
that you might need and install them for you.
Should you want to install a PHP extension yourself, we provide
pecl in the build environment, and you can simply
build: nodes: my-tests: dependencies: before: - pecl install ssh-beta
We provide several databases and queues including MySQL, PostgreSQL, and RabbitMQ pre-installed, if you like you can
also install custom software using
sudo apt-get in your build environment.
If you would like to run integration tests which access your website through a webserver, we provide easy configuration of Apache2 out-of-the-box:
build: nodes: functional-tests: environment: hosts: 'local.dev': '127.0.0.1' apache2: modules: ['rewrite'] sites: symfony_app: web_root: 'web/' host: 'local.dev'
If you are making use of PHPUnit, phpspec, code ception, or behat, we will automatically infer the test commands for you. You can override the inferred commands in your configuration:
build: nodes: my-tests: tests: override: - ./run-tests.sh
By default, we will automatically generate code coverage for your tests. If you change the test commands, you can also generate code-coverage manually. For example, if you are using PHPUnit, your configuration could look like this:
build: nodes: my-tests-with-coverage: tests: override: - command: phpunit --coverage-clover=my-coverage-file coverage: file: my-coverage-file format: php-clover
Scrutinizer will automatically process your coverage data and also merge it in case you run your tests in parallel, and also provide graphs that plot its evolution over time.
Scrutinizer provides first-class support for deployment. Once all your tests have passed, it will automatically trigger deployment of your code. You can define deploy commands in your configuration:
build: nodes: deploy: requires: - branch: master # you can use either the full branch name, - branch: /feature_.*/ # or a regular expression - node: my-tests # only runs if my-tests node succeeded commands: - cd deploy && cap deploy