TYPO3 Extbase, 3rd Edition (English)
TYPO3 Extbase, 3rd Edition (English)
Modern Extension Development for TYPO3 CMS with Extbase and Fluid
About the Book
Extensions play a central role in the development of complex TYPO3 CMS installations. To build effective solutions, every TYPO3 developer needs to know specific programming techniques. Today, the Extbase Framework and the Fluid Templating Engine are regarded as the standard.
This technical book is suited for both beginners and seasoned TYPO3 developers and provides all you need to know to plan and implement projects of any size with Extbase and Fluid. From the basics of object-oriented programming in PHP to the principles of domain-driven design (DDD) and the model-view-controller concept (MVC), the book explains theoretical foundations as well as practical solutions in an easily understandable way. An easy to follow introduction to the basics is followed by a step-by-step guide to developing real-world, complex scenarios using best practices. A dedicated chapter provides details on coding and security standards in TYPO3 and on how to add measures of security and avoid typical vulnerabilities when building extensions.
Gain insight to this advanced topic and learn how to write clean code that complies to modern standards and programming principles for TYPO3 v9 LTS and newer.
Table of Contents
-
Preface
- Patrick’s Background
- Michael’s Background
- Acknowledgements
- Piracy
-
1. The History of Extbase and Fluid
- 1.1 The Origin of TYPO3
- 1.2 Berlin Manifesto
- 1.3 New PHP Framework
- 1.4 The Death of the Phoenix
- 1.5 The Split
- 1.6 Extbase and Fluid
-
2. PHP Programming Basics
- 2.1 Object-Oriented Programming
- 2.2 Classes and Objects
-
2.3 Methods
- 2.3.1 The Arrow Operator
- 2.3.2 The Constructor
-
2.3.3 Access by Using
$this
- 2.3.4 Filling Methods with Content
-
2.4 Inheritance of Classes
-
2.4.1 Access by Using
parent
- 2.4.2 Verifying Class Derivation
-
2.4.1 Access by Using
- 2.5 Abstract Classes
- 2.6 Interfaces
-
2.7 Visibility: Public and Protected
- 2.7.1 Getter and Setter
- 2.8 Type Hints
- 2.9 Return Type Declarations
- 2.10 Strict Types
- 2.11 Static Calls
- 2.12 Namespaces
-
2.13 Important Design Patterns
- 2.13.1 Singleton
- 2.13.2 Prototype
- 2.13.3 Dependency Injection
- 2.14 Annotations
-
2.15 Coding Standards
- 2.15.1 PSR-1
- 2.15.2 PSR-2
- 2.15.3 Code Comments
-
3. Domain-driven Design
- 3.1 Infrastructure Ignorance
- 3.2 Vertical-Layered Architecture
-
3.3 The Domain Model
- 3.3.1 Ubiquitous Language
- 3.3.2 Building Blocks of DDD
-
3.4 Structuring DDD
- 3.4.1 Bounded Context
- 3.4.2 Context Map
- 3.4.3 Core Domain
- 3.4.4 Shared Kernel
- 3.5 Recap
-
4. Preparation
- 4.1 TYPO3 Pre-installed
-
4.2 Setting Up TYPO3
- 4.2.1 System Requirements
- 4.2.2 Installation Using PHP Composer
- 4.2.3 Site Package
- 4.2.4 Development Application Context
-
4.3 Extension Fundamentals
- 4.3.1 Extension Keys
- 4.3.2 TYPO3 Extension Repository
- 4.3.3 TER Extensions and Composer
- 4.3.4 Further Publishing Methods
- 4.3.5 Extensions, Plugins, Modules, and Distributions
- 4.3.6 Behind the Scenes
- 4.3.7 File and Directory Structure
- 4.4 Development Environment
- 4.5 Recap
-
5. Create a Domain Model
- 5.1 Domain Model Used in this Book
-
5.2 Basic Concept
- 5.2.1 The Glossary
- 5.2.2 Domain Model
-
5.3 The TYPO3 Extension Builder
- 5.3.1 History
- 5.3.2 How the Extension Builder Works
- 5.3.3 Target Audience
- 5.3.4 Limitations
- 5.3.5 Installation
- 5.3.6 Extension Properties
- 5.3.7 Domain Model
- 5.3.8 Domain Model Properties
- 5.3.9 Domain Model Relations
- 5.4 Extension Activation
- 5.5 Autoloading PHP Classes
- 5.6 Recap
-
6. Analysing Initial Files
-
6.1 Files Created by the Extension Builder
-
6.1.1 Files in the Folder
Classes/
-
6.1.2 Files in the Folder
Configuration/
-
6.1.3 Files in the Folder
Resources/
-
6.1.4 Files in the Folder
Tests/
- 6.1.5 Files in the Root Directory
-
6.1.1 Files in the Folder
-
6.2 Additional Functionality of the Extension Builder
- 6.2.1 Modifying the Model
-
6.3 TypoScript
constants
andsetup
- 6.4 Recap
-
6.1 Files Created by the Extension Builder
-
7. The CRUD Process
- 7.1 Model-View-Controller in Extbase
-
7.2 Creating an Object
- 7.2.1 Create Action in Controller
-
7.2.2 Creating the Template for the
listAction()
- 7.2.3 Side Note: Template Rendering
- 7.2.4 Create Static Blogs
- 7.2.5 Persisting Blogs
- 7.2.6 How Persistence Works
- 7.2.7 The PersistenceManager: Manual Persistence
- 7.2.8 Create Your Own Action
- 7.2.9 Form to Create an Object
- 7.3 Reading an Object
- 7.4 Updating an Object
-
7.5 Deleting an Object
- 7.5.1 Exercise
-
7.6 Fine-tuning of the Visual Appearance
- 7.6.1 “Font Awesome” Icons
- 7.6.2 List View: Align Buttons Right
- 7.6.3 Button Margins
- 7.7 Recap
-
8. Fluid Templating
- 8.1 Templates, Layouts and Partials
-
8.2 Using an Overall Layout
- 8.2.1 Multiple Sections
- 8.2.2 Optional Sections
-
8.3 Partials
- 8.3.1 Simple Partials
- 8.3.2 Complex Partials
- 8.4 Recap
-
9. Query Manager and Repositories
- 9.1 Repository Class
- 9.2 Magic Functions
-
9.3 Default Structure of a Query
- 9.3.1 Side Note: Debugging
-
9.4 Adjusting Queries
- 9.4.1 Determine Result Set
- 9.4.2 Limiting Result Set
- 9.4.3 Logical Conjunction
- 9.4.4 Native SQL
- 9.4.5 Query Settings
- 9.5 Example: Search for Keyword in Title
- 9.6 Dynamic Search in the Repository
- 9.7 Side Note: Request Object
- 9.8 Recap
-
10. TypoScript and FlexForm Configuration
-
10.1 TypoScript
- 10.1.1 Setup Scope
- 10.1.2 Sub-keys
-
10.1.3 Option:
view
-
10.1.4 Option:
persistence
-
10.1.5 Option:
objects
-
10.1.6 Option:
features
-
10.1.7 Option:
mvc
-
10.1.8 Option:
settings
-
10.1.9 Option:
_LOCAL_LANG
-
10.1.10 Option:
_CSS_DEFAULT_STYLE
-
10.2 FlexForms
- 10.2.1 FlexForm Configuration
- 10.2.2 Accessing the FlexForm Configuration
- 10.2.3 Accessing Settings Outside of a Controller
- 10.2.4 Switchable Controller Actions (SCA)
- 10.3 TypoScript for Backend Modules
- 10.4 Adjustments for the Next Chapters
- 10.5 Recap
-
10.1 TypoScript
-
11. Validation and Error Handling
- 11.1 Point where Validation Happens
-
11.2 Displaying Errors
- 11.2.1 ViewHelper: Validation Results
- 11.3 Validation Overview
-
11.4 Property Validation
- 11.4.1 Built-in Validators
- 11.4.2 Multiple Validators
- 11.4.3 Custom Validators
- 11.5 Object Validation
- 11.6 Action Validation
- 11.7 Explicitly Ignore Validation
-
11.8 Flash Messages
- 11.8.1 Generating Flash Messages
- 11.8.2 Displaying Flash Messages
- 11.8.3 Flash Message Queues
- 11.8.4 The Flash Message Queue in a Controller
- 11.8.5 Practice Option
- 11.9 Recap
-
12. ViewHelpers
-
12.1 ViewHelpers in General
- 12.1.1 Namespace
- 12.1.2 PHP Class Files
- 12.2 ViewHelpers in the TYPO3 Core
- 12.3 ViewHelpers by the Community
-
12.4 Custom ViewHelpers
- 12.4.1 Text-ViewHelper
- 12.4.2 TagBased-ViewHelper
- 12.4.3 Condition-ViewHelper
- 12.4.4 Widget-ViewHelper
-
12.5 Test Your Knowledge
- 12.5.1 Exercise: The Gravatar ViewHelper
- 12.5.2 Exercise: The A-to-Z Widget
-
12.6 Methods
renderStatic()
andrender()
- 12.7 Recap
-
12.1 ViewHelpers in General
-
13. Relations
- 13.1 Relation in Domain Model
-
13.2 The Table Configuration Array (TCA)
-
13.2.1 TCA:
ctrl
-
13.2.2 TCA:
interface
-
13.2.3 TCA:
types
-
13.2.4 TCA:
palettes
-
13.2.5 TCA:
columns
-
13.2.1 TCA:
-
13.3 The CRUD Process of Posts
- 13.3.1 Preparation
- 13.3.2 Create Posts
- 13.3.3 Read Posts
- 13.3.4 Update Posts
- 13.3.5 Delete Posts
-
13.4
m:n
-Relations (Tags)- 13.4.1 Creation of Tags in the Backend
- 13.4.2 Repository for Tags
-
13.4.3 Read Tags in the
Post
Controller - 13.4.4 Templates and Partials Adjustments
- 13.4.5 Show Tags in List of Posts
-
13.5
1:1
-Relations (Authors)- 13.5.1 Frontend Users and Groups
-
13.5.2 Map
Author
tofe_users
- 13.5.3 Implementing the Frontend Part
- 13.5.4 Auto-Assign Frontend User
- 13.5.5 Obfuscate Email Addresses
-
13.6 Comments as AJAX Requests
- 13.6.1 Controller and Action
- 13.6.2 Ajax Controller
- 13.6.3 Display of Comments
- 13.6.4 JavaScript
- 13.6.5 AJAX Page Type in TypoScript
- 13.7 Recap
-
14. Labels and Localization
- 14.1 Why Use Language Files?
-
14.2 Language Files
- 14.2.1 Placeholders
- 14.2.2 Variables
- 14.2.3 Update all Template Files
- 14.3 Overwrite Labels in TypoScript
-
14.4 Language Configuration
- 14.4.1 Website Language
- 14.4.2 Site Configuration
- 14.4.3 Page Translation
- 14.4.4 Content Element Translation
-
14.5 Localized Language File
- 14.5.1 Overwrite Labels in TypoScript
- 14.6 Language Labels in PHP
-
14.7 Domain Object Localization
- 14.7.1 The Table Configuration Array (TCA)
- 14.7.2 Translate Records
- 14.8 Recap
-
15. Property Mapper and Type Converter
-
15.1 Property Mapper
- 15.1.1 Type Converter
- 15.1.2 Property Mapper Configuration
-
15.2 File Upload Functionality
- 15.2.1 Security Aspects
- 15.2.2 Blog Controller
- 15.2.3 Upload FileReference Converter
- 15.2.4 Blog Domain Model
- 15.2.5 TCA of the Blog Domain Model
-
15.2.6
FileReference
Domain Model - 15.2.7 TypoScript
- 15.2.8 Partials and Templates
- 15.2.9 FormUpload-ViewHelper
- 15.3 File Upload Test
- 15.4 Recap
-
15.1 Property Mapper
-
16. Backend Module
- 16.1 Requirements and Solution Design
-
16.2 Basic Components
- 16.2.1 Module Registration
- 16.2.2 Language File
- 16.2.3 Abstract Backend Controller
-
16.3 First Function: List Comments
- 16.3.1 Comment Controller
- 16.3.2 Fluid Templates
-
16.4 Second Function: Dashboard
- 16.4.1 Extend Module Registration
- 16.4.2 Extend Action Menu
- 16.4.3 Dashboard Controller
- 16.4.4 Fluid Templates
- 16.4.5 Visualise Statistical Data
- 16.4.6 RequireJS
- 16.4.7 AJAX in the TYPO3 Backend
- 16.4.8 Add AJAX Functionality to JavaScript
- 16.4.9 Fine-tuning and Additional Notes
-
16.5 Styleguide Extension
- 16.5.1 Installation
- 16.5.2 Usage
- 16.6 Recap
-
17. Clean-up and Finalisation
- 17.1 Annotations
- 17.2 PSR-2 Coding Standard (“PHP CodeSniffer”)
- 17.3 DocBlocks (“phpDocumentor”)
- 17.4 Documentation
- 17.5 Recap
-
18. Security Basics
- 18.1 TYPO3 Security Team
- 18.2 Security in TYPO3 Extensions
-
18.3 Most Common Security Vulnerabilities
- 18.3.1 OWASP Top 10
- 18.3.2 Injection Flaws
- 18.3.3 Cross-site Scripting
- 18.3.4 Cross-Site Request Forgery
- 18.3.5 Lack of Access Control
- 18.4 Further Typical Security Vulnerabilities
-
19. What’s Next
- 19.1 Get Officially Certified
-
Appendix
- TYPO3 Release History
- Extension Declaration File
-
References and Further Reading
- Unofficial Websites
- PHP Security
- Glossary
- Changelog
- Notes
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them