Cargando…

Learning PHP 7.

Learn the art of PHP programming through this example-rich book filled to the brim with tutorials every PHP developer needs to knowAbout This Book Set up the PHP environment and get started with web programming Leverage the potential of PHP for server-side programming, memory management, and object-...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Lopez, Antonio (Autor)
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, Limited March 2016.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • 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.