Functional PHP. (2017)
- Record Type:
- Book
- Title:
- Functional PHP. (2017)
- Main Title:
- Functional PHP
- Other Names:
- Crettenand, Gilles
- Contents:
- Cover; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Customer Feedback; Table of Contents; Preface; Chapter 1: Functions as First Class Citizens in PHP; Before we begin; Coding standards; Autoloading and Composer; Functions and methods; PHP 7 scalar type hints; Anonymous functions; Closures; Closures inside of classes; Using objects as functions; The Closure class; Higher-order functions; What is a callable?; Summary; Chapter 2: Pure Functions, Referential Transparency, and Immutability; Two sets of input and output; Pure functions; What about encapsulation? Spotting side causesSpotting side effects; What about object methods?; Closing words; Immutability; Why does immutability matter?; Data sharing; Using constants; An RFC is on its way; Value objects; Libraries for immutable collections; Laravel Collection; Immutable.php; Referential transparency; Non-strictness or lazy evaluation; Performance; Code readability; Infinite lists or streams; Code optimization; Memoization; PHP in all that?; Summary; Chapter 3: Functional Basis in PHP; General advice; Making all inputs explicit; Avoiding temporary variables; Smaller functions Parameter order mattersThe map function; The filter function; The fold or reduce function; The map and filter functions using fold; Folding left and right; The MapReduce model; Convolution or zip; Recursion; Recursion and loops; Exceptions; PHP 7 and exceptions; Alternatives to exceptions; Logging/displaying error message;Cover; Copyright; Credits; About the Author; About the Reviewer; www.PacktPub.com; Customer Feedback; Table of Contents; Preface; Chapter 1: Functions as First Class Citizens in PHP; Before we begin; Coding standards; Autoloading and Composer; Functions and methods; PHP 7 scalar type hints; Anonymous functions; Closures; Closures inside of classes; Using objects as functions; The Closure class; Higher-order functions; What is a callable?; Summary; Chapter 2: Pure Functions, Referential Transparency, and Immutability; Two sets of input and output; Pure functions; What about encapsulation? Spotting side causesSpotting side effects; What about object methods?; Closing words; Immutability; Why does immutability matter?; Data sharing; Using constants; An RFC is on its way; Value objects; Libraries for immutable collections; Laravel Collection; Immutable.php; Referential transparency; Non-strictness or lazy evaluation; Performance; Code readability; Infinite lists or streams; Code optimization; Memoization; PHP in all that?; Summary; Chapter 3: Functional Basis in PHP; General advice; Making all inputs explicit; Avoiding temporary variables; Smaller functions Parameter order mattersThe map function; The filter function; The fold or reduce function; The map and filter functions using fold; Folding left and right; The MapReduce model; Convolution or zip; Recursion; Recursion and loops; Exceptions; PHP 7 and exceptions; Alternatives to exceptions; Logging/displaying error message; Error codes; Default value/null; Error handler; The Option/Maybe and Either types; Lifting functions; The Either type; Libraries; The functional-php library; How to use the functions; General helpers; Extending PHP functions; Working with predicates; Invoking functions Manipulating dataWrapping up; The php-option library; Laravel collections; Working with Laravel's Collections; The immutable-php library; Using immutable.php; Other libraries; The Underscore.php library; Saber; Rawr; PHP Functional; Functional; PHP functional programming Utils; Non-standard PHP library; Summary; Chapter 4: Composing Functions; Composing functions; Partial application; Currying; Currying functions in PHP; Parameter order matters a lot!; Using composition to solve real issues; Summary; Chapter 5: Functors, Applicatives, and Monads; Functors; Identity function; Functor laws Identity functorClosing words; Applicative functors; The applicative abstraction; Applicative laws; Map; Identity; Homomorphism; Interchange; Composition; Verifying that the laws hold; Using applicatives; Monoids; Identity law; Associativity law; Verifying that the laws hold; What are monoids useful for?; A monoid implementation; Our first monoids; Using monoids; Monads; Monad laws; Left identity; Right identity; Associativity; Validating our monads; Why monads?; Another take on monads; A quick monad example; Further reading; Summary; Chapter 6: Real-Life Monads; Monadic helper methods … (more)
- Publisher Details:
- Birmingham : Packt Publishing
- Publication Date:
- 2017
- Extent:
- 1 online resource (342 pages)
- Subjects:
- 006.8
COMPUTERS -- Programming Languages -- PHP
COMPUTERS -- Programming Languages -- General
COMPUTERS -- Web -- General
Electronic books
Electronic books - Languages:
- English
- ISBNs:
- 9781785886911
- Access Rights:
- Legal Deposit; Only available on premises controlled by the deposit library and to one user at any one time; The Legal Deposit Libraries (Non-Print Works) Regulations (UK).
- Access Usage:
- Restricted: Printing from this resource is governed by The Legal Deposit Libraries (Non-Print Works) Regulations (UK) and UK copyright law currently in force.
- View Content:
- Available online (eLD content is only available in our Reading Rooms) ↗
- Physical Locations:
- British Library HMNTS - ELD.DS.127432
- Ingest File:
- 02_117.xml