Learning PHP 7

 
 
Packt Publishing Limited
  • 1. Auflage
  • |
  • erschienen am 29. März 2016
  • |
  • 414 Seiten
 
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
978-1-78588-341-5 (ISBN)
 
Learn the art of PHP programming through this example-rich book filled to the brim with tutorials every PHP developer needs to knowAbout This BookSet up the PHP environment and get started with web programmingLeverage the potential of PHP for server-side programming, memory management, and object-oriented programming (OOP)This book is packed with real-life examples to help you implement the concepts as you learnWho This Book Is ForIf you are a web developer or programmer who wants to create real-life web applications using PHP 7, or a beginner who wants to get started with PHP 7 programming, this book is for you. Prior knowledge of PHP, PHP 7, or programming is not mandatory.What You Will LearnSet up a server on your machine with PHPUse PHP syntax with the built-in server to create appsApply the OOP paradigm to PHP to write richer codeUse MySQL to manage data in your web applicationsCreate a web application from scratch using MVCAdd tests to your web application and write testable codeUse an existing PHP framework to build and manage your applicationsBuild REST APIs for your PHP applicationsTest the behavior of web applications with BehatIn DetailPHP is a great language for building web applications. It is essentially a server-side scripting language that is also used for general purpose programming. PHP 7 is the latest version with a host of new features, and it provides major backwards-compatibility breaks.This book begins with the fundamentals of PHP programming by covering the basic concepts such as variables, functions, class, and objects. You will set up PHP server on your machine and learn to read and write procedural PHP code. After getting an understanding of OOP as a paradigm, you will execute MySQL queries on your database. Moving on, you will find out how to use MVC to create applications from scratch and add tests. Then, you will build REST APIs and perform behavioral tests on your applications.By the end of the book, you will have the skills required to read and write files, debug, test, and work with MySQL.Style and approachThis book begins with the basics that all PHP developers use every day and then dives deep into detailed concepts and tricks to help you speed through development. You will be able to learn the concepts by performing practical tasks and implementing them in your daily activities, all at your own pace.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
978-1-78588-341-5 (9781785883415)
1785883410 (1785883410)
weitere Ausgaben werden ermittelt
Antonio Lopez is a software engineer with more than 7 years of experience. He has worked with PHP since university, which was 10 years ago, building small personal projects. Later, Antonio started his journey around Europe, working in Barcelona, London, Dublin, and back in Barcelona. He has worked in a number of different areas, from web applications to REST APIs and internal tools. Antonio likes to spend his spare time on personal projects and start-ups and has a strong vocation in education and teaching.
  • Cover
  • Copyright
  • Credits
  • About the Author
  • About the Reviewer
  • www.PacktPub.com
  • Table of Contents
  • Preface
  • Chapter 1: Setting Up the Environment
  • Setting up the environment with Vagrant
  • Introducing Vagrant
  • Installing Vagrant
  • Using Vagrant
  • Setting up the environment on OS X
  • Installing PHP
  • Installing MySQL
  • Installing Nginx
  • Installing Composer
  • Setting up the environment on Windows
  • Installing PHP
  • Installing MySQL
  • Installing Nginx
  • Installing Composer
  • Setting up the environment on Ubuntu
  • Installing PHP
  • Installing MySQL
  • Installing Nginx
  • Summary
  • Chapter 2: Web Applications with PHP
  • The HTTP protocol
  • A simple example
  • Parts of the message
  • URL
  • The HTTP method
  • Body
  • Headers
  • The status code
  • A more complex example
  • Web applications
  • HTML, CSS, and JavaScript
  • Web servers
  • How they work
  • The PHP built-in server
  • Putting things together
  • Summary
  • Chapter 3 : Understanding PHP Basics
  • PHP files
  • Variables
  • Data types
  • Operators
  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Incrementing and decrementing operators
  • Operator precedence
  • Working with strings
  • Arrays
  • Initializing arrays
  • Populating arrays
  • Accessing arrays
  • The empty and isset functions
  • Searching for elements in an array
  • Ordering arrays
  • Other array functions
  • PHP in web applications
  • Getting information from the user
  • HTML forms
  • Persisting data with cookies
  • Other superglobals
  • Control structures
  • Conditionals
  • Switch.case
  • Loops
  • While
  • Do.while
  • For
  • Foreach
  • Functions
  • Function declaration
  • Function arguments
  • The return statement
  • Type hinting and return types
  • The filesystem
  • Reading files
  • Writing files
  • Other filesystem functions
  • Summary
  • Chapter 4: Creating Clean Code with OOP
  • Classes and objects
  • Class properties
  • Class methods
  • Class constructors
  • Magic methods
  • Properties and methods visibility
  • Encapsulation
  • Static properties and methods
  • Namespaces
  • Autoloading classes
  • Using the __autoload function
  • Using the spl_autoload_register function
  • Inheritance
  • Introducing inheritance
  • Overriding methods
  • Abstract classes
  • Interfaces
  • Polymorphism
  • Traits
  • Handling exceptions
  • The try.catch block
  • The finally block
  • Catching different types of exceptions
  • Design patterns
  • Factory
  • Singleton
  • Anonymous functions
  • Summary
  • Chapter 5: Using Databases
  • Introducing databases
  • MySQL
  • Schemas and tables
  • Understanding schemas
  • Database data types
  • Numeric data types
  • String data types
  • List of values
  • Date and time data types
  • Managing tables
  • Keys and constraints
  • Primary keys
  • Foreign keys
  • Unique keys
  • Indexes
  • Inserting data
  • Querying data
  • Using PDO
  • Connecting to the database
  • Performing queries
  • Prepared statements
  • Joining tables
  • Grouping queries
  • Updating and deleting data
  • Updating data
  • Foreign key behaviors
  • Deleting data
  • Working with transactions
  • Summary
  • Chapter 6: Adapting to MVC
  • The MVC pattern
  • Using Composer
  • Managing dependencies
  • Autoloader with PSR-4
  • Adding metadata
  • The index.php file
  • Working with requests
  • The request object
  • Filtering parameters from requests
  • Mapping routes to controllers
  • The router
  • URLs matching with regular expressions
  • Extracting the arguments of the URL
  • Executing the controller
  • M for model
  • The customer model
  • The book model
  • The sales model
  • V for view
  • Introduction to Twig
  • The book view
  • Layouts and blocks
  • Paginated book list
  • The sales view
  • The error template
  • The login template
  • C for controller
  • The error controller
  • The login controller
  • The book controller
  • Borrowing books
  • The sales controller
  • Dependency injection
  • Why is dependency injection necessary?
  • Implementing our own dependency injector
  • Summary
  • Chapter 7: Testing Web Applications
  • The necessity for tests
  • Types of tests
  • Unit tests and code coverage
  • Integrating PHPUnit
  • The phpunit.xml file
  • Your first test
  • Running tests
  • Writing unit tests
  • The start and end of a test
  • Assertions
  • Expecting exceptions
  • Data providers
  • Testing with doubles
  • Injecting models with DI
  • Customizing TestCase
  • Using mocks
  • Database testing
  • Test-driven development
  • Theory versus practice
  • Summary
  • Chapter 8: Using Existing PHP Frameworks
  • Reviewing frameworks
  • The purpose of frameworks
  • The main parts of a framework
  • Other features of frameworks
  • Authentication and roles
  • ORM
  • Cache
  • Internationalization
  • Types of frameworks
  • Complete and robust frameworks
  • Lightweight and flexible frameworks
  • An overview of famous frameworks
  • Symfony 2
  • Zend Framework 2
  • Other frameworks
  • The Laravel framework
  • Installation
  • Project setup
  • Adding the first endpoint
  • Managing users
  • User registration
  • User login
  • Protected routes
  • Setting up relationships in models
  • Creating complex controllers
  • Adding tests
  • The Silex microframework
  • Installation
  • Project setup
  • Managing configuration
  • Setting the template engine
  • Adding a logger
  • Adding the first endpoint
  • Accessing the database
  • Silex versus Laravel
  • Summary
  • Chapter 9: Building REST APIs
  • Introducing APIs
  • Introducing REST APIs
  • The foundations of REST APIs
  • HTTP request methods
  • GET
  • POST and PUT
  • DELETE
  • Status codes in responses
  • 2xx - success
  • 3xx - redirection
  • 4xx - client error
  • 5xx - server error
  • REST API security
  • Basic access authentication
  • OAuth 2.0
  • Using third-party APIs
  • Getting the application's credentials
  • Setting up the application
  • Requesting an access token
  • Fetching tweets
  • The toolkit of the REST API developer
  • Testing APIs with browsers
  • Testing APIs using the command line
  • Best practices with REST APIs
  • Consistency in your endpoints
  • Document as much as you can
  • Filters and pagination
  • API versioning
  • Using HTTP cache
  • Creating a REST API with Laravel
  • Setting OAuth2 authentication
  • Installing OAuth2Server
  • Setting up the database
  • Enabling client-credentials authentication
  • Requesting an access token
  • Preparing the database
  • Setting up the models
  • Designing endpoints
  • Adding the controllers
  • Testing your REST APIs
  • Summary
  • Chapter 10: Behavioral Testing
  • Behavior-driven development
  • Introducing continuous integration
  • Unit tests versus acceptance tests
  • TDD versus BDD
  • Business writing tests
  • BDD with Behat
  • Introducing the Gherkin language
  • Defining scenarios
  • Writing Given-When-Then test cases
  • Reusing parts of scenarios
  • Writing step definitions
  • The parameterization of steps
  • Running feature tests
  • Testing with a browser using Mink
  • Types of web drivers
  • Installing Mink with Goutte
  • Interaction with the browser
  • Summary
  • Index

Dateiformat: EPUB
Kopierschutz: Adobe-DRM (Digital Rights Management)

Systemvoraussetzungen:

Computer (Windows; MacOS X; Linux): Installieren Sie bereits vor dem Download die kostenlose Software Adobe Digital Editions (siehe E-Book Hilfe).

Tablet/Smartphone (Android; iOS): Installieren Sie bereits vor dem Download die kostenlose App Adobe Digital Editions (siehe E-Book Hilfe).

E-Book-Reader: Bookeen, Kobo, Pocketbook, Sony, Tolino u.v.a.m. (nicht Kindle)

Das Dateiformat EPUB ist sehr gut für Romane und Sachbücher geeignet - also für "fließenden" Text ohne komplexes Layout. Bei E-Readern oder Smartphones passt sich der Zeilen- und Seitenumbruch automatisch den kleinen Displays an. Mit Adobe-DRM wird hier ein "harter" Kopierschutz verwendet. Wenn die notwendigen Voraussetzungen nicht vorliegen, können Sie das E-Book leider nicht öffnen. Daher müssen Sie bereits vor dem Download Ihre Lese-Hardware vorbereiten.

Weitere Informationen finden Sie in unserer E-Book Hilfe.


Download (sofort verfügbar)

40,53 €
inkl. 19% MwSt.
Download / Einzel-Lizenz
ePUB mit Adobe DRM
siehe Systemvoraussetzungen
E-Book bestellen

Unsere Web-Seiten verwenden Cookies. Mit der Nutzung dieser Web-Seiten erklären Sie sich damit einverstanden. Mehr Informationen finden Sie in unserem Datenschutzhinweis. Ok