aboutsummaryrefslogtreecommitdiffstats
path: root/posts/libsodium-php-in-travis-ci.md
blob: af98e4b4a19113854bc4f53749356b9d0325078b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: Using libsodium-php in Travis-CI
published: 2017-01-25
updated: 2017-01-25
---

**Update**: switched to new PPA, from `ppa:chris-lea/libsodium` to 
`ppa:ondrej/php` that contains a newer `libsodium` that actually has 
`\Sodium\compare`.

For my OAuth 2.0 server I needed to be able to use 
[libsodium](https://github.com/jedisct1/libsodium) in PHP, unfortunately the 
images on Travis-CI are still based on Ubuntu _precise_, or if you want 
_trusty_, but they do not contain `libsodium-dev` which would be needed to 
install the PECL module `libsodium-php`.

So, below you'll find my `.travis.yml` that installs both `libsodium-dev` from
a PPA and builds the PECL module:

    language: php
    sudo: required
    php:
      - 5.4
      - 5.5
      - 5.6
      - 7.0
      - 7.1
    before_install:
      - sudo add-apt-repository ppa:ondrej/php -y
      - sudo apt-get update -q
      - sudo apt-get install libsodium-dev -y
    before_script:
      - pecl install libsodium
      - composer install

    script: phpunit --coverage-text tests