Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
The (currently) ideal TYPO3 composer setup
{
"require": {
"typo3-console/composer-auto-setup": "^0.1",
"georgringer/news": "^6.1",
"helhum/typo3-secure-web": "^0.2.5",
"typo3/cms-introduction": "^3.0"
},
"extra": {
"typo3/cms": {
"cms-package-dir": "{$vendor-dir}/typo3/cms",
"web-dir": "public",
"root-dir": "private"
},
"helhum/typo3-console": {
"install-extension-dummy": "0"
}
},
"require-dev": {
"typo3-console/php-server-command": "^0.1.1"
}
}
#!/bin/bash
####################################################################################################################
# These are the command line steps to get to a composer.json file you see below
# I suggest to exeute them if you want to learn step by step what happens in each step
# However if you just want results, use the composer.json above
####################################################################################################################
# Create a new directory and switch into it
mkdir demo && cd demo
# Start with initializing git version control
git init && git commit --allow-empty -m 'initial commit'
# That is how we started a few years ago
composer require typo3/cms
# Save the current composer.json in git history
git add composer.json && git commit -m "Add composer.json"
# Move the TYPO3 package to the composer standard location
composer config extra.typo3/cms.cms-package-dir '{$vendor-dir}/typo3/cms'
# cleanup and re-install
git clean -dffx && composer install
# Move most things out of the web server's document root
composer config extra.typo3/cms.web-dir 'public'
# cleanup and re-install
git clean -dffx && composer install
# Add a package which adds TYPO3 Console convenience to your composer execution (similar to minimum distribution)
# You will be asked for mysql credentials and other TYPO3 setup things in this step
composer require typo3-console/composer-auto-setup ^0.1
# Disable a deprecated console feature
composer config extra.helhum/typo3-console.install-extension-dummy 0
# Add some little dev helpers for starting a PHP based web server
composer require --dev typo3-console/php-server-command
# Start the server and investigate the backend (ctrl + c to quit)
typo3cms server:run
# Add Georg's News extension
composer require georgringer/news
# Go to the backend and directly add new records
typo3cms server:run
# Now to the really cool stuff
# Configure a "private" directory, which will be the place where your TYPO3 installation lives
composer config extra.typo3/cms.root-dir 'private'
# It previously lived in public, but will now be private, so move the dir upfront
# so we do not have to re-install everything during the demo
# The new things in the public folder will all be generated, thus this folder should be in .gitignore completely
mv public private
# To activate / evaluate the new settings and generate the public folder/files, require this package
composer require helhum/typo3-secure-web
# Uh, nice everything still works, but is secure by default.
# Change your extensions to have public assets in Resources/Public only to get the most out of it.
typo3cms server:run
# Bonus
# You can now even remove the full TYPO3 composer package and use the individual ones instead.
# helhum/typo3-secure-web comes with requirements to the basic TYPO3 extensions already.
# You can require other packages as well in your extensions or later in root composer.json
rm -rf vendor/typo3/cms private/typo3/sysext && composer remove typo3/cms
# One more thing
# If you require a distribution, it will import the data automatically after this command line
# So you can get a fully working TYPO3 website with one composer command (clone repo, composer install)
composer require typo3/cms-introduction
# make sure you also commit the lock file along with your composer.json once you're finished
git add composer.json composer.lock
git commit -m 'Finish demo distribution'
# Yes, you can verify that you have a full website now
typo3cms server:run
# Clean up and see that only composer.json and composer.lock remains
git clean -dffx
# After a composer install, you will be asked for db connection data and after process is finished
# you have a fully working TYPO3 installation including data
composer install
@markwatney2016

This comment has been minimized.

Copy link

markwatney2016 commented Nov 6, 2017

I suggest to use git clean -dffx -e .idea to avoid the deletion of project specific PHPStorm setting.

@josefglatz

This comment has been minimized.

Copy link

josefglatz commented Dec 3, 2017

Custom extension icons could not be loaded when using your provided composer.json. It's a 404. The path seems correct.
I wonder alse where the .htaccess is handled.

image

Do have some idea @helhum?

EDIT: I didn't used the PHP webserver. I ran it in an dockerized environment

@helhum

This comment has been minimized.

Copy link
Owner Author

helhum commented Dec 25, 2017

@josefglatz Extension Icons need to be in Resouces/Public/Icons/Extension.png

Works since TYPO3 8.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.