Showing what's new in PHP 8 with examples and tests

Overview

#PHP 8 what's new with examples

Showing what's new in PHP 8 with examples and tests. I believe that reading about the changes is not enough, so grab this Docker and give all changes a try. Read the docs Luke!

How does it work?

Every new change has its own separate test. Read the tests, modify them and have fun!

Documentation

  1. 8.0 https://www.php.net/releases/8.0/en.php
  2. 8.1

What's new in Php 8

  1. Named arguments: https://www.php.net/releases/8.0/en.php#named-arguments
  2. Attributes: https://www.php.net/releases/8.0/en.php#attributes
  3. Constructor property promotion: Constructor property promotion: https://www.php.net/releases/8.0/en.php#attributes
  4. Union types: https://www.php.net/releases/8.0/en.php#attributes
  5. Match expression: https://www.php.net/releases/8.0/en.php#match-expression

Starting app

docker-compose up -d

Main page - localhost

http://localhost:8080/

Php info

http://localhost:8080/php_info.php

Xdebug info

http://localhost:8080/xdebug_info.php

Running tests

docker-compose run php vendor/bin/phpunit

Using PhpUnit in PhpStorm

  1. PhpUnit By Remote Interpreter
  2. Provide full docker path to autoloader.php /opt/project/vendor/autoload.php

Pro publico bono by Grzegorz Bielski

You might also like...
Examples of some common design patterns implemented in php

What is a Design Pattern? Design patterns are typical solutions to common problems in software design. Each pattern is like a blueprint that you can c

PHP examples - Refactoring by Martin Fowler

Refatoração - segunda edição - Exemplos em PHP https://www.youtube.com/watch?v=TBHehDRuVCs Prefácio: Case de refatoração x entregas e prazos O que é r

Mvc - Phalcon MVC Examples

Phalcon MVC Examples These are examples of MVC file structures you can employ using Phalcon = 3.0.x For further documentation, check out the Phalcon

Examples of the power of WordPress plugins that will wreck your site.

Examples of the power of WordPress plugins that will wreck your site.

Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker.
Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker.

symfony-api Fully covered with tests, documented by Swagger and dockerized API based on enterprise-level framework with optional queue worker. ⚙️ Depl

Adds factory functions for WooCommerce to be used with wp-browser integration tests.

wp-browser-woocommerce This library simplifies testing of WooCommerce themes and plugins with wp-browser. Several Unit Test Factories are added that a

Phalcon Mooc an example API + Front End with automated tests
Phalcon Mooc an example API + Front End with automated tests

NovaMooc - a Phalcon project A Mooc project developed with Phalcon, a PHP framework. Key Features • How To Use • Contributing • Credits • License Key

Laravel package for a Game of Tests

Game of Tests laravel This package aims to enable a quick implementation of a Game of Tests in Laravel. Is uses the package swisnl/game-of-tests and g

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

PHPUnit Polyfills Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests. Requirements Instal

Owner
Grzegorz Bielski
I love engineering
Grzegorz Bielski
PHP demo application showing how to access the Hubstaff Public API

Public API PHP Demo This repository contains a simple sample cli tool that shows off how to access the Hubstaff public api via PHP. The core access is

Netsoft Holdings 5 Dec 6, 2022
Yab copy to new - A Textpattern plugin. Copies the current article content to a new one.

yab_copy_to_new Displays a new button in article write tab to copy the current article to a new one. Version: 0.2 Table of contents Plugin requirement

Tommy Schmucker 2 Dec 15, 2017
Demo serverless applications, examples code snippets and resources for PHP

The Serverless LAMP stack Examples Code example Description AWS blog link 0.1-SimplePhpFunction A very simple implementation of a PHP Lambda function.

AWS Samples 303 Dec 20, 2022
SERP Scraping API code examples for Python, PHP and Node.js

SERP Scraping API List of contents Introduction Authentication Google Baidu Bing Yandex Parameters Targets Languages License Introduction With our SER

Smartproxy 8 Nov 7, 2022
Custom code snippets and examples for SkyVerge-built WooCommerce extensions

SkyVerge WooCommerce Plugins Welcome to the wc-plugins-snippets repository! This repository stores code snippets related to SkyVerge WooCommerce plugi

SkyVerge 255 Nov 16, 2022
Wordpress Plugin Boilerplate but Powered with examples and a generator!

WordPress Plugin Boilerplate Powered WordPress Plugin Boilerplate Powered is a complete foundation for building your WordPress plugins following PSR-4

WordPress Plugin Boilerplate Powered 604 Dec 24, 2022
Some Joomla! 4.x Web Services Api Examples and Experiments to raise the level of awareness of the huge potiental of Joomla! 4.x Web Services.

j4x-api-examples WHY? If you are a Joomla! developer or want to become a Joomla! developer there is a new resource for you The Official New Joomla! Ma

Mr Alexandre ELISÉ 11 Nov 29, 2022
Sitepackage for TYPO3 CMS that adheres to the recommended standards, maps all conceivable functional areas and contains examples for common use cases.

TYPO3 CMS Sitepackage This sitepackage sticks as closely as possible to the recommended standard and maps all conceivable functional areas. There are

Eric Bode 3 Dec 18, 2022
the examples of head first object oriented analysis & design - in PHP

Head First object oriented analysis & design in (PHP) after cloning the repository, you have to install the project's dependancies by running the foll

Muhammed ElFeqy 3 Oct 16, 2021
Design Pattern Examples in PHP

Design Patterns in PHP This repository is part of the Refactoring.Guru project. It contains PHP examples for all classic GoF design patterns. Each pat

Refactoring.Guru 909 Dec 22, 2022