Yii2 By Example

Packt Publishing Limited
  • 1. Auflage
  • |
  • erschienen am 29. September 2015
  • |
  • 344 Seiten
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
E-Book | ePUB mit Adobe DRM | Systemvoraussetzungen
978-1-78528-367-3 (ISBN)
Develop complete web applications from scratch through practical examples and tips for beginners and more advanced usersAbout This BookImprove your programming experience and become a full stack developerMaster real-life web applications, and create and manage four different projectsStep-by-step guidance to develop real-world web applications smoothlyWho This Book Is ForThis book is for anyone who wants to discover and explore Yii Framework. Basic programming experience with PHP and object oriented programming is assumed.What You Will LearnUnderstand basic concepts, along with the installation and customization of YiiDiscover models, controllers, and views-concepts applied in a web context-and how they are employed in YiiUse ActiveRecord to manipulate a databaseAdd access control to your web application through authentication and authorizationInstall and customize an advanced template for multiple applications in the same projectCreate a RESTful Web Service to allow remote access to dataDevelop a console application to launch a command in the console as an automated task (cron job)Make code reusable through widgets and components and localize text messages to make a multilanguage web appIn DetailYii is a high-performance PHP framework best for developing Web 2.0 applications. It provides fast, secure, and professional features to create robust projects, however, this rapid development requires the ability to organize common tasks together to build a complete application. It's all too easy to get confused; this is where this book comes in.This book contains a series of practical project examples for developers starting from scratch. Each section contains the most relevant theories for every topic as you walk through developing each project, focusing on key aspects that commonly confuse users.The book starts with all the framework's basic concepts, such as controllers and views, to introduce you to Yii and creating your first application, a simple news reader. You will be learn to configure URL rules to make a pretty URL, essential for search engine optimization. Next, you will walk through Model and ActiveRecord, key concepts in database interaction.The second application you will develop is a reservation system that allows you to manage rooms, customers, and reservations. For this, you will use database connection through SQL and ActiveRecord. More complex than the first one, this application will introduce you to the advanced template of Yii 2, splitting the app into two parts: a frontend for all visitors and a backend for the admin. Finally, you will move on to the last two applications: one that allows connections from remote clients, through RESTful components of Yii 2, and another that creates and organizes automatic tasks using the console application structure of Yii 2.Style and approachThis is a step-by-step guide with each topic introduced in the context of real-world applications, highlighting common cases where users may encounter difficulties.
  • Englisch
  • Birmingham
  • |
  • Großbritannien
978-1-78528-367-3 (9781785283673)
1785283677 (1785283677)
weitere Ausgaben werden ermittelt
Fabrizio Caldarelli is an Italian programmer who started his professional career in his youth by programming with desktop-oriented languages, the first being Visual Basic. From the year 2000 onward, he spent 5 years developing software to manage radio broadcasts. During that period, he studied C#.NET to make porting of all software versus this new platform.
During the same period, he learned web programming, HTML, and ASP, and in 2003, he began to develop software using PHP as the default programming language for web pages. During those years, he collaborated as a teacher for PHP programming courses with http://www.html.it/, an important online reference for developers in Italy.
In 2008, he added new skills to his experience by starting to develop mobile projects for Nokia devices with Symbian C++, and a few years later, he started working on projects for iOS, Android, and naturally Windows phone.
After many PHP-based web projects, in late 2012, he moved on to the Yii framework as his primary framework for developing web applications.
Since then, he has built many important projects based on Yii 1 and later on Yii 2, day by day discovering the powerful improvement that Yii provides to getting work done.
Now he lives in Sacrofano, a small town near Rome, with his wife, Serena.
  • Cover
  • Copyright
  • Credits
  • About the Author
  • About the Reviewers
  • www.PacktPub.com
  • Table of Contents
  • Preface
  • Chapter 1: Starting with Yii2
  • Requirements and tools
  • Installing Yii2 with Composer
  • Application structure
  • Application properties
  • Common application components
  • Handling application events
  • The MVC pattern in Yii2
  • Naming convention
  • Configuring the debug toolbar
  • Using the logger
  • Example - Hello world from scratch with the Yii basic template and bootstrap template
  • Summary
  • Chapter 2: Creating a Simple News Reader
  • Creating Controller and Action
  • Creating a view to display a news list
  • How the controller sends data to view
  • Example - create a controller to display the static news items list and details using the bootstrap template
  • Splitting the common view content into reusable views
  • Example - render partial in view
  • Creating static pages
  • Example - add a contact page
  • Sharing data between views and layout
  • Example - change the layout background based on a URL parameter
  • Layout with dynamic block
  • Example - add a dynamic box to display advertising info
  • Using multiple layouts
  • Example - using different layouts to create responsive and nonresponsive content layout for the same view
  • Summary
  • Chapter 3: Making Pretty URLs
  • Using pretty URLs
  • Custom URL rules
  • Example - list news items by year or category
  • Default parameters in rules
  • Example - the index page to display the links list
  • The complete URL rule parameters
  • The URL pattern to support the multilanguage view
  • Creating the rule class
  • Summary
  • Chapter 4: Creating a Room through Forms
  • Creating a Model
  • Example - a Model to store room data
  • Using ActiveForm
  • Example - creating a new room from the HTML form
  • Format date, time, and numbers
  • Uploading files
  • Example - uploading an image of a room
  • Summary
  • Chapter 5: Developing a Reservation System
  • Configuring a DB connection
  • Example - creating rooms, customers, and reservations tables
  • Example - test connection and executing the SQL query
  • Using Gii to create room, customer, and reservation models
  • Using ActiveRecord to manipulate data
  • Example - query rooms list with ActiveRecord
  • Working with relationships
  • Example - using a relationship to connect rooms, reservations, and customers
  • How to save a model from a form
  • Example - creating and updating a room from a form
  • Setting up the GMT time zone
  • Using multiple database connections
  • Example - configuring a second DB connection to export data to a local SQLite DB
  • Summary
  • Chapter 6: Using a Grid for Data and Relations
  • Introduction
  • DataProvider for grids
  • Using a grid
  • Custom columns in a grid
  • Example - displaying a reservations list by clicking on a customer grid row
  • Filters in GridView
  • Displaying and filtering ActiveRecord relational data in a grid's column
  • A summarized footer row in a grid
  • Example - extending GridView to customize the footer row in a grid
  • Multiple grids on one page
  • Example: managing the reservations and rooms grids in the same view
  • Summary
  • Chapter 7: Working on the User Interface
  • Using Gii to generate CRUD
  • Example - using CRUD to manage rooms, reservations, and customers using Gii
  • Customize JavaScript and CSS
  • Example - using JavaScript and CSS to display advertising columns that disappear if not enough space is available
  • Using AJAX
  • Example - reservation details loaded from the customers' drop-down lists
  • Using the Bootstrap widget
  • Example: using datepicker
  • Multiple models in the same view
  • Example - saving multiple customers at the same time
  • Saving linked models in the same view
  • Example - creating a customer and reservation in the same view
  • Summary
  • Chapter 8: Log in to the App
  • Creating a user login
  • Example - a login form to access
  • Configuring user authorization
  • Example - creating an ACF to authorize the users
  • RBAC
  • Example - configuring RBAC to set permissions for users
  • Mixing ACF and RBAC
  • Example - managing users' roles to access rooms, reservations, and customers
  • Summary
  • Chapter 9: Frontend to Display Rooms to Everyone
  • Using an advanced template to split frontend and backend
  • Configuring an application using init
  • Example - creating frontend for public access
  • Sharing ActiveRecord models among applications
  • Example - displaying available rooms in the frontend site
  • Customizing a URL in the advanced template
  • Example - using the advanced template in the same domain
  • How to use the advanced template in the shared hosting
  • Summary
  • Chapter 10: Localize the App
  • Setting the default language
  • File-based translations
  • Example - using file-based translation for the entire website
  • Placeholders formatting
  • DB-based translations
  • Example - translating room descriptions using DB
  • Summary
  • Chapter 11: Creating an API for Use in a Mobile App
  • Configuring a REST app in the advanced template
  • Creating a controller
  • Example - creating a controller to manage rooms
  • Authentication
  • Example - using authentication to get a customers list
  • New controller action
  • Example - getting a rooms list for a reservation
  • Customizing authentication and response
  • Example - status response node in data received
  • Other forms of export - RSS
  • Example - creating an RSS with a list of available rooms
  • Summary
  • Chapter 12: Create a Console Application to Automate the Periodic Task
  • Interacting with console applications
  • Creating a console controller
  • Example - setting an alarm flag for expired reservation
  • Formatting the output from the console
  • Implementing and executing cron jobs
  • Example - sending an e-mail with new reservations of the day
  • Summary
  • Chapter 13: Final Refactoring
  • Creating widgets
  • Example - creating a widget with a carousel
  • Creating components
  • Example - creating a component that creates a backup of the MySQL database and sends an e-mail to the administrator
  • Creating modules
  • Generating an API documentation
  • Example - using an API documentation to generate a doc of app and services
  • Summary
  • Index

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


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)

35,85 €
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