PHP Web Development with Laminas: Build a fully secured and functional e-commerce application with PHP using the Laminas framework
- Length: 394 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2022-11-18
- ISBN-10: 1803245360
- ISBN-13: 9781803245362
- Sales Rank: #5777104 (See Top 100 Books)
Learn how to develop modern object-oriented applications with PHP using test-driven development (TDD) and behavior-driven development (BDD) aided by mature reusable components
Key Features
- Create clean code based on components’ reusability to create large-scale enterprise applications
- Make effective use of design patterns in an object-oriented software
- Understand the division of a PHP web application structure in layers to build customized websites and apps for various business needs
Book Description
Considered the next generation of the Zend framework, Laminas is a high-performance PHP framework for creating powerful web applications with an evolutive architecture.
This book takes a hands-on approach to equip you with the knowledge of the Laminas framework necessary to start building web applications based on the reuse of loosely coupled components. You’ll learn how to create the basic structure of a PHP web application divided into layers, understand Laminas’ MVC components, and be able to take advantage of the Eclipse platform as a method for developing with Laminas. Step by step, you’ll build an e-commerce application based on the technical requirements of a fictional business, and get to grips with implementing those requirements using Laminas components.
By the end of this web development book, you’ll be able to build a completely secured MVC application in PHP language using Laminas.
What you will learn
- Discover how object-relational mapping is implemented with laminas-db
- Understand behavior-driven development concepts to sharpen your skills
- Create lean controllers and flexible views
- Build complete models and reusable components
- Explore the Eclipse platform for developing with Laminas
- Find out how easy it is to generate HTML forms with laminas-form
- Practice test-driven development to write precise programs
Who this book is for
This book is best suited for programming beginner or developers with some experience looking to create clean-coded object-oriented web applications. Knowledge of basic PHP syntax, specifically variables, control structures, and functions, will aid you in understanding the concepts covered.
Cover Copyright Foreword Contributors Table of Contents Preface Part 1: Technical Background Chapter 1: Introducing Laminas for PHP Applications Why do we need web frameworks? Continuous integration and continuous delivery The usefulness of a framework From Zend Framework to Laminas My introduction to Zend Framework Zend Framework – the reference architecture for PHP applications The differences between Zend Framework and Laminas The technical and social infrastructure of the Laminas community Summary Chapter 2: Setting Up the Environment for Our E-Commerce Application Technical requirements Installing Laminas Installing Laminas through an isolated component of Laminas Installing Laminas through an MVC skeleton application Configuring the IDE – Eclipse for PHP developers Integrating Laminas and Eclipse Managing MySQL Summary Chapter 3: Using Laminas as a Library with Test-Driven Development Technical requirements Understanding the software requirements Use case – managing school classes Implementing a structure for the use case Creating our first automated test Developing our use case with TDD Creating our SchoolClassTest test class Creating a test method in the SchoolClass class Creating the SchoolClass class Configuring autoloading of classes Configuring the autoloading of test classes Creating the config.php file and rerunning the SchoolClassTest test case Creating a new testInserting test method Creating an edition form edit.php Creating a SchoolClassTest->testUpdating test method Altering edit.php Altering save.php Creating the delete.php file Generating code coverage reports Summary Chapter 4: From Object-Relational Mapping to MVC Containers Technical requirements Using ORM Use case – managing students Implementing the use case Running the SchoolClassTest->testListing test Adjusting CRUD files Using Laminas as a container Creating the school3 project Creating the School module Ensuring the module has the right namespace Implementing the test methods Running the tests Summary Part 2: Creating an E-Commerce Application Chapter 5: Creating the Virtual Store Project Technical requirements Understanding the project requirements for the sample web application Identifying use cases and actors Understanding the class diagram for Whatstore Creating the project instance Understanding the structure of a Laminas project Preparing the modules for our project Summary Chapter 6: Models and Object-Relational Mappers with Behavior-Driven Development Technical requirements BDD with Behat Creating our first scenario Mapping a user story to an automated test Creating models from user stories Creating mappers from user stories Adding a product to the products table Checking whether the product was inserted Creating a generic model and a generic mapper Creating other models with Behat Summary Chapter 7: Request Control and Data View Technical requirements Understanding the relationship between HTTP and PHP The request life cycle in the Laminas MVC Implementing CRUD with a controller and view pages Testing our current test cases Testing product insertion Testing product recovery Testing product updates Testing product deletion Creating the ProductAPIController class Implementing the ProductController class Implementing the pages for ProductController Implementing the interaction between the web interface and API Testing the interaction between the web interface and API Summary Chapter 8: Creating Forms and Implementing Filters and Validators Technical requirements Generating a form for discounts with laminas-form Creating CRUD implementation using the laminas-form component Creating a class to define an HTML form Filtering input data Validating input data Summary Chapter 9: Event-Driven Authentication Technical requirements Creating login and logout actions for the Inventory module Creating tests for login and logout actions Creating login and logout actions Implementing the user authentication for the Inventory module Creating the employee’s registration Testing the login page Verifying user identity based on events Delegating the authentication listener to a module Summary Chapter 10: Event-Driven Authorization Technical requirements Creating roles registration Creating resources registration Filling the resources table Associating resources with roles Associating roles with users Implementing access control Verifying users’ permissions Modifying the test bootstrap Creating an identity manager Summary Further reading Part 3: Review and Refactoring Chapter 11: Implementing a Product Basket Technical requirements Managing the product inventory Refactoring the customer home page Controlling the product basket Controlling the customers Order closing Decoupling the generic behavior of authentication Summary Chapter 12: Reviewing and Improving Our App Technical requirements Principles of agile development Eliminating duplicated code Removing unnecessary configuration Creating a product search box Generating API documentation Isolating identity management for each module Modifying the class for identity management Refactoring listener and controller classes Summary Chapter 13: Tips and Tricks Technical requirements Creating mapped models Customizing filters and validators Creating a customized filter Creating a customized validator Understanding the Laminas view layer Producing JSON responses with laminas-view Uploading files with laminas-form Changing the application layout Mastering the controller layer Detecting AJAX requests Exchanging messages between the controller and view layers Finishing controller actions Summary Chapter 14: Last Considerations Other Laminas components Cache CLI Crypt CSRF DOM Escaper Feed Hydrator JSON-RPC server LDAP Log Microservice-oriented development Building APIs Community resources Summary Index Other Books You May Enjoy
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: PHP Web Development with Laminas: Build a fully secured and functional e-commerce application with PHP using the Laminas framework
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.