Modular Programming with PHP 7
eBook - ePub

Modular Programming with PHP 7

Branko Ajzele

Share book
  1. 332 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Modular Programming with PHP 7

Branko Ajzele

Book details
Book preview
Table of contents
Citations

About This Book

Utilize the power of modular programming to improve code readability, maintainability, and testability

About This Book

  • This book demonstrates code reusability and distributed development to get high speed, maintainable, and fast applications
  • It illustrates the development of a complete modular application developed using PHP7 in detail
  • This book provides a high-level overview of the Symfony framework, a set of tools and a development methodology that are needed to build a modular web shop application

Who This Book Is For

This step-by-step guide is divided into two sections. The first section explores all the fundamentals of modular design technique with respect to PHP 7. The latter section demonstrates the practical development of individual modules of a web shop application.

What You Will Learn

  • Discover the new features of PHP 7 that are relevant to modular application development
  • Write manageable code based on the GoF design patterns and SOLID principles
  • Define the application requirements of a working modular application
  • Explore the ins and outs of the Symfony framework
  • Build a set of modules based on the Symfony framework that comprise a simple web shop app
  • Use core modules to set the structure and dependencies for other modules to use
  • Set up entities that are relevant to the module functionality and see how to manage these entities

In Detail

Modular design techniques help you build readable, manageable, reusable, and more efficient codes. PHP 7, which is a popular open source scripting language, is used to build modular functions for your software. With this book, you will gain a deep insight into the modular programming paradigm and how to achieve modularity in your PHP code.

We start with a brief introduction to the new features of PHP 7, some of which open a door to new concepts used in modular development. With design patterns being at the heart of all modular PHP code, you will learn about the GoF design patterns and how to apply them. You will see how to write code that is easy to maintain and extend over time with the help of the SOLID design principles.

Throughout the rest of the book, you will build different working modules of a modern web shop application using the Symfony framework, which will give you a deep understanding of modular application development using PHP 7.

Style and approach

This book is for intermediate-level PHP developers with little to no knowledge of modular programming who want to understand design patterns and principles in order to better utilize the existing frameworks for modular application development.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Modular Programming with PHP 7 an online PDF/ePUB?
Yes, you can access Modular Programming with PHP 7 by Branko Ajzele in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming Languages. We have over one million books available in our catalogue for you to explore.

Information

Year
2016
ISBN
9781786462954
Edition
1

Modular Programming with PHP 7


Table of Contents

Modular Programming with PHP 7
Credits
About the Author
About the Reviewer
www.PacktPub.com
eBooks, discount offers, and more
Why subscribe?
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Ecosystem Overview
Getting ready for PHP 7
Scalar type hints
Return type hints
Anonymous classes
The Closure::call() method
Generator delegation
Generator return expressions
The null coalesce operator
The Spaceship operator
Throwables
The \ParseError
Level support for the dirname() function
The integer division function
Constant arrays
Uniform variable syntax
Secure random number generator
Filtered unserialize()
Context sensitive lexer
Group use declarations
Unicode enhancements
Assertions
Changes to the list() construct
Session options
Deprecated features
Frameworks
Laravel framework
Symfony
Zend Framework
CodeIgniter
CakePHP
Slim
Yii
Phalcon
Summary
2. GoF Design Patterns
Creational patterns
Abstract factory pattern
Builder pattern
Factory method pattern
Prototype pattern
Singleton pattern
Structural patterns
Adapter pattern
Bridge pattern
Composite pattern
Decorator pattern
Facade pattern
Flyweight pattern
Proxy pattern
Behavioral patterns
Chain of responsibility pattern
Command pattern
Interpreter pattern
Iterator pattern
Mediator pattern
Memento pattern
Observer pattern
State pattern
Strategy pattern
Template pattern
Visitor pattern
Summary
3. SOLID Design Principles
Single responsibility principle
Open/closed principle
Liskov substitution principle
Interface Segregation Principle
Dependency inversion principle
Summary
4. Requirement Specification for a Modular Web Shop App
Defining application requirements
Wireframing
Defining a technology stack
The Symfony framework
Foundation framework
Summary
5. Symfony at a Glance
Installing Symfony
Creating a blank project
Using Symfony console
Controller
Routing
Templates
Forms
Configuring Symfony
The bundle system
Databases and Doctrine
Testing
Validation
Summary
6. Building the Core Module
Requirements
Dependencies
Implementation
Configuring application-wide security
Unit testing
Functional testing
Summary
7. Building the Catalog Module
Requirements
Dependencies
Implementation
Creating entities
Managing image uploads
Overriding core module services
Setting up a Category page
Setting up a Product page
Unit testing
Functional testing
Summary
8. Building the Customer Module
Requirements
Dependencies
Implementation
Creating a customer entity
Modifying the security configuration
Extending the customer entity
Creating the orders service
Creating the customer menu service
Implementing the register process
Implementing the login process
Implementing the logout process
Managing forgotten passwords
Unit testing
Functional testing
Summary
9. Building the Payment Module
Requirements
Dependencies
Implementation
Creating a card entity
Creating a card payment service
Creating a card payment controller and routes
Creating a check money payment service
Creating a check money payment controller and routes
Unit testing
Functional testing
Summary
10. Building the Shipment Module
Requirements
Dependencies
Implementation
Creating a flat rate shipment service
Creating a flat rate shipment controller and routes
Creating a dynamic rate payment service
Creating a dynamic rate shipment controller and routes
Unit testing
Functional testing
Summary
11. Building the Sales Module
Requirements
Dependencies
Implementation
Creating a Cart entity
Creating the cart item entity
Creating an Order entity
Creating a SalesOrderItem entity
Overriding the add_to_cart_url service
Overriding the checkout_menu service
Overriding the customer orders service
Overriding the bestsellers service
Creating the Cart page
Creating the Payment service
Creating the Shipment service
Creating the Checkout page
Creating the order success page
Creating a store manager dashboard
Unit testing
Functional testing
Summary
12. Integrating and Distributing Modules
Understanding Git
Understanding GitHub
Understanding Composer
Understanding Packagist
Summary
Index

Modular Programming with PHP 7

Copyright © 2016 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: September 2016
Production reference: 1020916
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78646-295-4
www.packtpub.com

Credits

Author
Branko Ajzele
Reviewer
Tomislav Sudmak
Commissioning Editor
Kunal Parikh
Acquisition Editor
Chaitanya Nair
Content Development Editor
Priyanka Mehta
Technical Editor
Ravikiran Pise
Copy Editor
Safis Editing
Project Coordinator
Izzat Contractor
Proofreader
Safis Editing
Indexer
Tejal Daruwale Soni
Graphics
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Branko Ajzele was born in January 1983 and lives in Osijek, Croatia. He is a husband, father of two, book author, and software developer. He holds a faculty degree in electrical engineering. He loves all things digital and makes a living out of software development.
Branko has years of hands-on experience in full-time software development and team management and specializes in e-commerce platforms. He has worked with Magento since 2008, knee-deep since its very first beta version. He is regularly in touch with modern software development technologies.
He has strong technical knowledge and is able to communicate technicalities clearly with strong direction. He feels comfortable proposing alternatives to demands that he feels can be improved, even when this means pulling a late shift to meet deadlines.
Branko holds several IT certifications such as Zend Certified Engineer (ZCE PHP), Magento Certified Developer (MCD), Magento Certified Developer Plus (MCD+), and Magento Certified Solution Specialist (MCSS).
Instant E-Commerce with Magento: Build a Shop by Packt Publishing was his first Magento-related book oriented toward Magento newcomers, after which he decided to write Getting Started ...

Table of contents