Skip to content

Instantly share code, notes, and snippets.

@vixe76
Forked from helhum/composer.json
Created November 5, 2017 18:52
Show Gist options
  • Select an option

  • Save vixe76/9842c14b78f822a8acfeee4ddd08fbdb to your computer and use it in GitHub Desktop.

Select an option

Save vixe76/9842c14b78f822a8acfeee4ddd08fbdb to your computer and use it in GitHub Desktop.

Revisions

  1. @helhum helhum revised this gist Nov 5, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion step-by-step.sh
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@
    ####################################################################################################################
    # 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 below
    # However if you just want results, use the composer.json above
    ####################################################################################################################

    # Create a new directory and switch into it
  2. @helhum helhum created this gist Nov 5, 2017.
    21 changes: 21 additions & 0 deletions composer.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    {
    "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"
    }
    }
    96 changes: 96 additions & 0 deletions step-by-step.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,96 @@
    #!/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 below
    ####################################################################################################################

    # 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