DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

Cover image for Github Action for PHP packages
Shivam Mathur
Shivam Mathur

Posted on • Updated on

Github Action for PHP packages

GitHub recently launched GitHub Actions which allows applications to do CI/CD in GitHub itself based on a workflow defined in a yml file which lives alongside the code in .github/workflows much like if you used Travis CI, you would have a .travis.yml file.

Anyone looking to test PHP packages can just use the setup-php action, run the tests and do CI/CD. The action sets up PHP, along with required extensions, tools and configuration. The setup-php action works on all virtual environments viz. linux, macOS and windows supported by GitHub actions. For more info check the PHP Action

GitHub logo shivammathur / setup-php

GitHub action to setup PHP with required extensions, php.ini configuration, code-coverage support and various tools like composer...

Here is an example of how you can use it

name: Test
on: [push]
jobs:
  build:
    strategy:
      matrix:
        operating-system: [ubuntu-latest, windows-latest, macos-latest]
        php-versions: ['7.2', '7.3', '7.4']
    runs-on: ${{ matrix.operating-system }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: ${{ matrix.php-versions }}
          extensions: mbstring, intl
          ini-values: post_max_size=256M, log_errors=1
          coverage: pcov
          tools: pecl
      .... Add more steps to install dependencies and then test

Enter fullscreen mode Exit fullscreen mode

Top comments (0)

πŸ” If you came here from Google, why not take a look at some of our top posts?