Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 2.42 KB

README.md

File metadata and controls

79 lines (52 loc) · 2.42 KB

php7-strict-types-testing

Testing the new behaviour of strict type hints

In order to test my article published in dzone.

Requirements:

The vagrant machine provisions PHP7 compiler and libraries needed for that.

In the event that you want to install manually in an ubuntu fresh installation:

git clone https://github.com/jlaso/php7-strict-types-testing.git

cd php7-strict-types-testing

vagrant up

This is to create a link between our ssh keys into the vagrant machine:

ssh-add ~/.ssh/id_rsa

once vagrant machine provisioned to enter into the machine:

vagrant ssh

first update the system and install needed packages:

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install openssl libssl-dev openssl-blacklist openssl-blacklist-extra  bison autoconf automake libtool re2c flex 
sudo apt-get install libxml2-dev libssl-dev libbz2-dev libcurl3-dev libdb5.1-dev libjpeg-dev libpng-dev libXpm-dev libfreetype6-dev libt1-dev libgmp3-dev libc-client-dev libldap2-dev libmcrypt-dev libmhash-dev freetds-dev libz-dev libmysqlclient15-dev ncurses-dev libpcre3-dev unixODBC-dev libsqlite-dev libaspell-dev libreadline6-dev librecode-dev libsnmp-dev libtidy-dev libxslt-dev libt1-dev

in order to install php from sources you need to clone the repo (be patient):

git clone https://github.com/php/php-src.git
cd php-src/

and now, following the official documentation:

./buildconf
./configure
make
sudo make install

check now if the version installed matches:

php -v

if not apears the expected version, you have to repeat the steps changing firstly to the branch you want.

In order to pass the tests you need to install PHPUnit. Following the official documentation:

wget https://phar.phpunit.de/phpunit.phar
chmod +x phpunit.phar
sudo mv phpunit.phar /usr/local/bin/phpunit

See the rest of the samples to check how to use the new strict types checking.

Inside the machine, sample code is located at /var/www/source.