Skip to content

This is the code respository for the book, Functional PHP, published by Packt

License

Notifications You must be signed in to change notification settings

PacktPublishing/Functional-PHP

Repository files navigation

Functional PHP

This is the code repository for Functional PHP, published by Packt. It contains all the supporting project files necessary to work through the book from start to finish.

About the Book

A functional approach encourages code reuse, greatly simplifies testing, and results in code that is concise and easy to understand. This book will demonstrate how PHP can also be used as a functional language, letting you learn about various function techniques to write maintainable and readable code

Instructions and Navigation

All of the code is organized into folders. Each folder starts with a number followed by the application name. For example, Chapter02.

The code will look like the following:

<?php
function getPrices(array $products) {
  $prices = [];
  foreach($products as $p) {
    if($p->stock > 0) {
      $prices[] = $p->price;
    }
  }
  return $prices;
}

You will need to have access to a computer with PHP installed. It will be easier if you know how to use the command line, but all examples should also work in a browser with maybe some small adaptations.

While learning functional programming, I also recommend the usage of a Read-Eval-Print-Loop (REPL). I personally used Boris when writing this book. You can find it at https://github.com/borisrepl/boris. Another great option is psysh, available at http://psysh.org.

Although not at all mandatory, a REPL will allow you to quickly test your ideas and play around with the various concepts that will be presented in this book without having to juggle between your editor and command line.

Related Products

About

This is the code respository for the book, Functional PHP, published by Packt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages