O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting Started with Phalcon

Book Description

Expand your PHP developer skills into the arena of creating web applications faster and better with Phalcon. Explore the MVC architecture and enjoy the ease of learning through practical instructions and screenshots.

In Detail

Phalcon is an open source PHP framework which makes developing with PHP easier and more efficient by combining the speed and performance of C with the unique development features of the MVC architecture. Phalcon is installed as a PHP module so you don't have to download an archive like you do with other frameworks, and building projects is made easier with its controllers and models. The Phalcon Query Language (PHQL) makes this tool even more expressive and clean. Its reputation as the most downloaded PHP tool is definitely justified by its rich offerings.

This tutorial provides you with the knowledge you need to build your very own web application with the revolutionary Phalcon framework. This comprehensive guide will start by describing the installation of Phalcon PHP. You will then learn how to build projects and how to further utilize the Phalcon Developer Tools to build models, views, and controllers with the central example of a blog application. Features like PHQL are also explained and implemented effectively throughout the book. The genius in you will be revered by the stunning web application that you will be able to create by reading this book.

This handy guide gives you a detailed introduction to using the remarkable Phalcon framework to develop web applications. You will begin by learning how to install the Phalcon module and how to build your own projects. The blog application is the central example throughout the book, and by using Phalcon Developer Tools and web tools, you will create and optimize the basic skeleton for your application with ease and efficiency.

You will learn how to add rich features to your blog using Phalcon Views, Models, and Controllers. You will also gain expertise in Phalcon functionalities like the Volt template engine, view helpers, PHQL, and so on.

This is an invaluable tutorial for enthusiasts and developers alike who wish to use the fascinating Phalcon PHP framework to rapidly design and develop impressive web applications.

What You Will Learn

  • Learn how to work with Phalcon developer
  • Work with Phalcon Developer Tools to generate application skeletons by building your blog application
  • Understand how PHQL is used to interact with databases like MySQL
  • Handle users, authorization, and session data in your Phalcon web application
  • Discover Phalcon's background tasks and the event manager
  • Create custom templates using the Volt engine
  • Manage your data relationships with Phalcon models

Table of Contents

  1. Getting Started with Phalcon
    1. Table of Contents
    2. Getting Started with Phalcon
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    7. Preface
      1. What this book covers
      2. Who this book is for
      3. Conventions
      4. Reader feedback
      5. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Installing Phalcon
      1. Phalcon system requirements
      2. Installing Phalcon on Windows
      3. Installing Phalcon on Linux
      4. Installing Phalcon on Mac
      5. Installing Phalcon on FreeBSD
      6. Optional Phalcon dependencies
      7. Finding help
      8. Summary
    9. 2. Setting Up a Phalcon Project
      1. Folder structure
      2. Using .htaccess files
      3. The bootstrap file
        1. Handling exceptions
        2. Dependency Injection
        3. Autoloaders
        4. Initializing our application
      4. Using a configuration file
      5. Phalcon Developer Tools
        1. Installing Phalcon Developer Tools
        2. Generating a project skeleton
        3. Available commands
        4. The web interface
        5. IDE stubs
      6. Setting up Phalcon\Debug
      7. Nginx configuration
      8. Summary
    10. 3. Using Phalcon Models, Views, and Controllers
      1. Introducing MVC
        1. View
        2. Controller
        3. Model
      2. Creating a database
      3. Creating a model
      4. Creating a controller
      5. Creating CRUD scaffolding
      6. Examining our Posts model
      7. Examining our Posts controller
        1. Create
        2. Search
        3. Index
        4. New
        5. Edit
        6. Save
        7. Delete
        8. Show
      8. Examining our Post views
        1. Posts layout
        2. Index action view
        3. Search action view
        4. Edit action view
        5. New action view
      9. Summary
    11. 4. Handling Data in Phalcon
      1. Adding models
        1. Creating the database tables
        2. Generating the models
      2. Storing session data in Phalcon
      3. Filtering and sanitizing data
      4. Phalcon models revisited
      5. Using PHQL
      6. Switching databases in Phalcon
      7. Phalcon's Object-Document Mapper and MongoDB
      8. Migrating databases
      9. Summary
    12. 5. Using Phalcon's Features
      1. Hashing passwords with Phalcon
      2. Using Phalcon view helpers
        1. Using dynamic title tags
        2. Setting the doctype
        3. Adding JavaScript and CSS with view helpers
      3. Setting cookies
      4. Controlling user access
      5. Applying the finishing touches to our application
        1. Adding comments
        2. Adding feeds
      6. Sending update pings
      7. Using view partials
      8. Caching in Phalcon
      9. Setting up a cache service
        1. Using a Phalcon cache
      10. Routing in Phalcon
      11. Other project types of Phalcon
        1. Multimodule applications
        2. Micro applications
        3. Command-line applications
      12. Summary
    13. Index