Skip to content

Instantly share code, notes, and snippets.

@vertexvaar
Last active January 17, 2019 13:27
Show Gist options
  • Select an option

  • Save vertexvaar/f6799e699a157f73e22606f38f17e8c8 to your computer and use it in GitHub Desktop.

Select an option

Save vertexvaar/f6799e699a157f73e22606f38f17e8c8 to your computer and use it in GitHub Desktop.
Neos Flow Framework Features you probably didn't know

Features

./flow package:create (The hidden feature)

Okay, let's be honest. You know that package:create command. But did you know, that if your composer.json contains a repository with a local path Flow will create the package in that path and run a composer require .?

The composer.json has to look like this:

{
    "name": "vendor/distro",
    "description": "Vendor Distro Something",
    "config": {
        "bin-dir": "bin",
        "vendor-dir": "Packages/Libraries"
    },
    "repositories": [
        {
            "type": "path",
            "url": "./Repository/*"
        },
    ],
    "scripts": {
        "post-install-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
        "post-update-cmd": "Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall",
        "post-package-install": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall",
        "post-package-update": "Neos\\Flow\\Composer\\InstallerScripts::postPackageUpdateAndInstall"
    }
}

The essential Part is, that the url begins with ./ and ends with /* for the feature to work.

Distribution Files in Packages

Wanna replace the index.php of your distribution? Wanna deliver an .htaccess file with your package? Tired of writing scripts that copy stuff during deployment?

Try installer-resource-folders now and get a surprise for free!

This composer package extra config tells the flow framework to copy files during package installation.

Pack your stuff into your package's Resources/Private/Installer/Distribution/Defaults or Resources/Private/Installer/Distribution/Essentials folder and add the extra section to your package's composer.json:

{
    "name": "vendor/package",
    "description": "Vendor Package Something",
    "extra": {
        "neos": {
            "installer-resource-folders": [
                "Resources/Private/Installer/"
            ]
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment