The Art of Seduction
معرفی کتاب «The Art of Seduction» نوشتهٔ Matt Smith و Aja Foxx، منتشرشده توسط نشر 2022 در سال 2022. این کتاب در فرمت epub، زبان انگلیسی ارائه شده است.
From First Script to Full Website—Fast!Tired of cobbling together PHP solutions from scattered online tutorials? Frustrated by outdated PHP practices that leave your code vulnerable and hard to maintain? Whether you’re building your first dynamic website or modernizing legacy systems, PHP Crash Course gives you a complete, practical foundation for writing professional web applications.In this comprehensive, example-driven guide, you’ll learn how to:- Write clean, maintainable PHP code using modern language features and best practices- Build secure web applications that protect against common vulnerabilities- Master database integration using PDO and object-relational mappings (ORMs)- Implement professional features like shopping carts and user authentication- Structure applications using object-oriented programming and model-view-controller (MVC) patterns- Leverage powerful tools like Composer and Twig to accelerate developmentStarting with PHP fundamentals, you’ll progress through six carefully crafted sections covering essential patterns, security best practices, database integration, and advanced concepts like object-oriented programming. Each chapter builds on real-world examples, giving you the skills to solve common development challenges.Whether you’re a complete beginner or an experienced developer looking to modernize your PHP skills, PHP Crash Course gives you everything you need to build professional, dynamic websites with confidence.Includes setup instructions for Windows, macOS, and Linux, and configuration details for Replit, the free online development environment. Cover Title Page Copyright Dedication About the Author About the Technical Reviewers Brief Contents Contents in Detail Acknowledgments Introduction Who This Book Is For Why PHP? What You Will Learn Online Resources Part I: Language Fundamentals 1. PHP Program Basics Two Methods to Run PHP The Replit Online Coding Environment A Local PHP Installation Template Text vs. PHP Code Comments Variables Creating Variables Using Variables Naming Variables Constants Operators and Operands Arithmetic Operators Combined Arithmetic Assignment Operators Increment and Decrement Operators Summary Exercises 2. Data Types PHP Data Types Scalar Data Types The Special NULL Type Functions to Test for a Data Type Type Juggling Numeric Contexts String Contexts Comparative Contexts Logical and Other Contexts Type Casting Summary Exercises 3. Strings and String Functions Whitespace Single-Quoted Strings Joining Strings: Concatenation Double-Quoted Strings Handling the Character After a Variable Name Incorporating Unicode Characters Heredocs Escape Sequences Indention Nowdocs Built-in String Functions Converting to Upper- and Lowercase Searching and Counting Extracting and Replacing Substrings Trimming Whitespace Removing All Unnecessary Whitespace Repeating and Padding Summary Exercises 4. Conditionals Conditions Are True or False if Statements if...else Statements Nested if...else Statements if...elseif...else Statements Alternative Syntax Logical Operators NOT AND OR XOR switch Statements match Statements The Ternary Operator The Null-Coalescing Operator Summary Exercises 5. Custom Functions Separating Code into Multiple Files Reading in and Executing Another Script Creating Absolute Filepaths Declaring and Calling a Function Parameters vs. Arguments Errors from Incorrect Function Calls Type Juggling Functions Without Explicit Return Values Returning NULL Exiting a Function Early Calling Functions from Within Functions Functions with Multiple Return and Parameter Types Nullable Types Union Types Optional Parameters Positional vs. Named Arguments Skipped Parameters Pass-by-Value vs. Pass-by-Reference Summary Exercises Part II: Working with Data 6. Loops while Loops do... while Loops Boolean Flags break Statements for Loops Using the Counter in the Loop Skipping Loop Statements Handling the Last Iteration Differently Alternative Loop Syntax Avoiding Infinite Loops Summary Exercises 7. Simple Arrays Creating an Array and Accessing Its Values Updating an Array Appending an Element Adding an Element with a Specific Key Appending Multiple Elements Removing the Last Element Retrieving Information About an Array Looping Through an Array Using a foreach Loop Accessing Keys and Values Imploding an Array Functions with a Variable Number of Arguments Array Copies vs. Array References Treating Strings as Arrays of Characters Other Array Functions Summary Exercises 8. Sophisticated Arrays Declaring Array Keys Explicitly Arrays with Strings as Keys Multidimensional Arrays More Array Operations Removing Any Element from an Array Combining and Comparing Arrays Destructuring an Array into Multiple Variables Callback Functions and Arrays Summary Exercises 9. Files and Directories Reading a File into a String Confirming That a File Exists “Touching” a File Ensuring That a Directory Exists Writing a String to a Text File Managing Files and Directories Reading a File into an Array Using Lower-Level File Functions Processing Multiple Files JSON and Other File Types Summary Exercises Part III: Programming Web Applications 10. Client/Server Communication and Web Development Basics The HTTP Request-Response Cycle Response Status Codes An Example GET Request How Servers Operate Simple Web Servers for File Retrieval Dynamic Web Servers for Processing Data The Routing Process Templating PHP Tags Short Echo Tags The Model-View-Controller Architecture Structuring a PHP Web Development Project Summary Exercises 11. Creating and Processing Web Forms Basic Client/Server Communication for Web Forms GET vs. POST Requests A Simple Example The filter_input() Function Other Ways to Send Data Sending Noneditable Data Along with Form Variables Processing Mixed Query-String and POST Variables Offering Multiple Submit Buttons Encoding Data in Hyperlinks Other Form Input Types Radio Buttons Checkboxes Single-Selection Lists Multiple-Selection Lists Summary Exercises 12. Validating Form Data Writing Custom Validation Logic Managing Multiple Validation Errors Testing for a Valid Zero Value Displaying and Validating Forms in a Single Postback Script Simple Validation Logic Array-Based Validation Logic Summary Exercises 13. Organizing a Web Application Front Controllers and the MVC Architecture Separating Display and Logic Files Creating the Front Controller Writing the Display Scripts Moving Website Logic into Functions Designing a Secure Folder Structure Simplifying the Front-Controller Script Writing the Functions Generalizing the Front-Controller Structure Distinguishing Between Requested Pages Building a Multipage Application Summary Exercises Part IV: Storing User Data with Browser Sessions 14. Working with Sessions A Web Browser Session The session_start() and session_id() Functions The $_SESSION Superglobal Array Updating a Stored Value Unsetting a Value Destroying the Session and Emptying the Session Array Summary Exercises 15. Implementing a Shopping Cart The Shopping Cart File Structure Defining the Product List Creating the Products Array Adding CSS Displaying the Star Ratings Creating the Template Script Updating the Index Script Designing the Shopping Cart Creating the Front Controller Managing the Product and Cart Arrays Streamlining the Index Script Creating a Header Template Creating the Cart Display Template Interacting with the Session Updating the Cart-Retrieval Function Implementing Cart-Manipulation Functions Creating the Empty Cart Template Finalizing the Front Controller Adding Display Functions Writing the switch Statement Summary Exercises 16. Authentication and Authorization A Simple Login Form Creating a Site with a Login Form Defining the File Structure Creating the Shared Page Content Designing the Page Templates Developing the Login Form Writing the Front Controller Implementing the Logic Functions Creating the Error Page Template Storing Login Data with Sessions Updating the Front Controller Writing the Login Function Updating the Header Template Updating the Banking Page Template Offering a Logout Feature Adding the Logout Function Updating the Front Controller Displaying the Logout Link Displaying the Logged-in Username Retrieving the Username Updating the Navigation Bar Updating the CSS Summary Exercises Part V: Object-Oriented PHP 17. Introduction to Object-Oriented Programming Classes and Objects Creating Relationships Between Objects Encapsulation and Information Hiding Superclasses, Inheritance, and Overriding The Flow of Control for Object-Oriented Systems An Example Class Declaration Summary Exercises 18. Declaring Classes and Creating Objects Declaring a Class Creating an Object Private Properties with Public Accessor Methods Getting and Setting Private Properties Screening for Invalid Data Overriding Default Class Behavior with Magic Methods Initializing Values with a Constructor Method Converting Objects to Strings Object Variables as References Handling Missing Objects Custom Methods and Virtual Attributes Summary Exercises 19. Inheritance Inheritance as Generalization Creating Objects from Subclasses Using Multiple Levels of Inheritance Protected Visibility Abstract Classes Overriding Inherited Methods Augmenting Inherited Behavior Preventing Subclassing and Overriding Declaring a Class final Declaring a Method final Summary Exercises 20. Managing Classes and Namespaces with Composer Namespaces Declaring a Class’s Namespace Using a Namespaced Class Referencing Namespaces in Class Declarations Composer Installing and Testing Composer Creating the composer.json Configuration File Creating an Autoloader Adding Third-Party Libraries to a Project Where to Find PHP Libraries Summary Exercises 21. Efficient Template Design with Twig The Twig Templating Library How Twig Works A Simple Example Manipulating Objects and Arrays in Twig Templates Twig Control Structures Creating a Multipage Website with Twig The File Structure and Dependencies The Application Class The Twig Templates Twig Features to Improve Efficiency Improved Page Styling with CSS Summary Exercises 22. Structuring an Object-Oriented Web Application Separating Display and Front-Controller Logic Using Multiple Controller Classes Sharing Controller Features Through Inheritance Summary Exercises 23. Error Handling with Exceptions The Basics of Exceptions Throwing an Exception Catching an Exception Ending with a finally Statement Using Multiple Exception Classes Other Built-in Exception Classes Custom Exception Classes Call-Stack Bubbling Summary Exercises 24. Logging Events, Messages, and Transactions Built-in PHP Resources for Logging Predefined Constants for Severity Levels Logging Functions The Monolog Logging Library Organizing Logs with Channels Managing Logs According to Severity Logging Exceptions Logging to the Cloud Summary Exercises 25. Static Methods, Properties, and Enumerations Storing Class-Wide Information Static Properties vs. Class Constants Utility Classes with Static Members Sharing Resources Across an Application Saving Resources with the Singleton Pattern Enumerations Backed Enums An Array of All Cases Summary Exercises 26. Abstract Methods, Interfaces, and Traits From Inheritance to Interfaces Inheriting a Fully Implemented Method from a Superclass Inheriting an Abstract Method Requiring Method Implementations with Interfaces Real-World Applications of Interfaces Caching Approach 1: Using an Array Caching Approach 2: Using a JSON File Caching Approach 3: Creating a Cacheable Interface Traits Declaring Traits Inserting Traits Resolving Trait Conflicts What to Use When? Summary Exercises Part VI: Database-Driven Application Development 27. Introduction to Databases Relational Database Basics Database Management Systems Structured Query Language Databases and Web Application Architecture Object-Oriented Programming The Model-View-Controller Pattern Summary Exercises 28. Database Programming with the PDO Library The PDO Library A Simple Database-Driven Web Application Setting Up the Database Schema Writing the PHP Classes Switching from MySQL to SQLite A Multipage Database-Driven Web Application Managing the Product Information Implementing the Controller Logic Designing the Templates Summary Exercises 29. Programming Crud Operations Deleting Data Deleting Everything from a Table Deleting Individual Items by ID Creating New Database Entries Adding Products Through a Web Form Highlighting the Newly Created Product Updating a Database Entry Avoiding Double Form Submission with Redirects Summary Exercises 30. Orm Libraries and Database Security Simplifying Database Code with an ORM Library Adding an ORM Library to a Project Moving Database Credentials to a .env File Relegating Product Operations to the ORM Library Adding a New Database Table Security Best Practices Storing Hashed Passwords Verifying Hashed Passwords at Login Securing Database Credentials The Doctrine ORM Library Removing the Previous ORM Library Adding Doctrine Verifying That Doctrine Is Working Creating Database Tables Adding Records to a Table Integrating Doctrine into the Application Code Creating Foreign-Key Relationships Summary Exercises 31. Working with Dates and Times The ISO 8601 Standard Creating Dates and Times Formatting the Date-Time Information Using DateTimeImmutable vs. DateTime Manipulating Dates and Times Using Date-Time Intervals Looping at Regular Intervals Time Zones Daylight Saving Time Epochs and Unix Time Date-Time Information in a Web Application The Application Class The Supporting Classes The Templates MySQL Dates Summary Exercises A. Installing PHP macOS Linux Windows AMP Installations B. Database Setup MySQL macOS and Windows Linux SQLite Confirming the MySQL and SQLite Extensions C. Replit Configuration Changing the PHP Version Adding the Composer Tool Using the SQLite Database System Serving Pages from the public Directory Index Back Cover From First Script to Full Website—Fast! Tired of cobbling together PHP solutions from scattered online tutorials? Frustrated by outdated PHP practices that leave your code vulnerable and hard to maintain? Whether you’re building your first dynamic website or modernizing legacy systems,PHP Crash Course gives you a complete, practical foundation for writing professional web applications. In this comprehensive, example-driven guide, you’ll learn how to Write clean, maintainable PHP code using modern language features and best practices Build secure web applications that protect against common vulnerabilities Master database integration using PDO and object-relational mappings (ORMs) Implement professional features like shopping carts and user authentication Structure applications using object-oriented programming and model-view-controller (MVC) patterns Leverage powerful tools like Composer and Twig to accelerate development Starting with PHP fundamentals, you’ll progress through six carefully crafted sections covering essential patterns, security best practices, database integration, and advanced concepts like object-oriented programming. Each chapter builds on real-world examples, giving you the skills to solve common development challenges. Whether you’re a complete beginner or an experienced developer looking to modernize your PHP skills,PHP Crash Course gives you everything you need to build professional, dynamic websites with confidence. Includes setup instructions for Windows, macOS, and Linux, and configuration details for Replit, the free online development environment. Start off your web development journey the right way with this beginner-friendly introduction to PHP programming. This book will take you from beginner-level to professional PHP programming, through hundreds of in-depth examples and hands-on exercises. You’ll explore best practices for developing fast, secure, and easy-to-maintain websites, while establishing a broad foundation of programming knowledge and experience. You’ll learn how to: Create consistent, modern-looking web pages with easily customizable templates by combining dynamic PHP scripts, static HTML code, and Bootstrap styling Write server-side scripts for responding to HTTP requests, processing forms, and validating data Use browser sessions to implement shopping carts and user logins, and to store other user data Write scripts that can communicate with MySQL and other PDO databases, enabling database-driven, data-rich web applications Implement modern, best-practice website security, including user data sanitization, session-based logins using hashed passwords, and database prepared statements Save time with up-to-date, professional, open-source tools, including Composer dependency management and the Twig templating library As you follow along, you’ll learn real-life patterns and modern programming techniques for creating, extending, and modifying web applications, all using the powerful PHP language.
دانلود کتاب The Art of Seduction