I'll show a set of TYPO3 Commands, that helps you automate TYPO3 installation and deployment and therefore let's you achieve more with doing less, hence increase your productivity.
TYPO3 Console TYPO3 Console TYPO3 Console in a nutshell • Command line interface for TYPO3 • Built for humans • Usable by robots • Powerful • Extendable • Comes as composer package with CLI binary 3
TYPO3 Console Building blocks Composer • Builds a project package from set of requirements • Provides several extension points to execute additional code • Better performance with optimized class loading 67
TYPO3 Console Building blocks PackageStates.php • Tracks which extensions should be active • Is changed when (de-)activating extensions in EM • Bad for automated processes • What to do for automated deployment? • typo3/cli_dispatch.phpsh extbase extension:install
• typo3cms extension:activate • Merge conflicts during a project lifetime 69
TYPO3 Console Building blocks Generate PackageStates.php • Add PackageStates.php to your .gitignore • typo3cms install:generatepackagestates • Everything in typo3conf/ext/ is marked active • Every required TYPO3 core extension is marked active • Why would you install code, but mark it as inactive? • Each line of code is one line with potential security issues or bugs 71
TYPO3 Console Building blocks Create TYPO3 folder structure • Creates all required folders • Including ones defined by (active) extensions • Perfect for creating typo3temp/** • Makes it possible to start with empty typo3temp/ for every deployment • (Reconsider clean start when using gifbuilder or similar) • (Maybe reconsider using gifbuilder) 77
TYPO3 Console Building blocks Set up active extensions • One command • Same as activating every single extension in EM manually • Idempotent • Executing once or multiple times leads to same result • Fast • Does not flush caches • Groups DB schema update 82
TYPO3 Console Building blocks Set up TYPO3 from CLI • Completely automatable • No more manual clicking in web installer • Sets up active extensions as last step • Ideal for dev setup • Local LAMP • Vagrant • Docker 85
TYPO3 Console Building blocks Set up TYPO3 from CLI • NOT idempotent • Needs LocalConfiguration.php to be absent • Writes its own LocalConfiguration.php during setup • Only useful for INITIAL deployment 87
TYPO3 Console Building blocks Update database schema • Can be used WITHOUT any tables in database • By default not destructive* • Adds tables and fields • Changes tables and fields • * Be careful with type and size changes • Works great for initial and subsequent deployments 90
TYPO3 Console Building blocks Extension setup if possible • Combines DB schema update with extension setup • typo3cms database:updateschema • typo3cms cache:fush • typo3cms extension:setup • Gracefully exits in failure case • Ideal as composer post autoload dump script 93
TYPO3 Console Building blocks Create your own commands • As composer package • As TYPO3 extension • Configuration/Console/Commands.php • Classes/Command/YourCommandController.php • Every public function with suffix „Command“ • https://github.com/TYPO3-Console/php-server-command • PHPDoc extracted as help text 99
TYPO3 Console Bonus Upgrade TYPO3 from CLI • Fast • Unattended • Idempotent • Can be executed for every deployment • Write your own upgrade wizards for migrations • Prepare everything locally and lean back during deploy 105
TYPO3 Console One more thing helhum/typo3-distribution • Multiple environment support • One or more configuration files depending on context • Merged in LocalConfiguration.php for production • Reasonable default dev and prod config • Yaml or PHP file support • Extension configuration as plain arrays • Overridable with environment specific config 109
TYPO3 Console One more thing helhum/typo3-distribution • Auto setup on composer install • Fully automatable for defined environments • Prompts for user input for setup if required/ wanted • Ready for dev and deploy • Easy to customize 110