Kickstart a package

Create the file structure

Create the following file structure and files. Explanation to the files is coming below:

Start in folder Packages:

  • Applications
    • Layh.Events
      • Classes
        • Layh
          • Events
            • EventController.php
      • Configuration
        • Routes.yaml
      • Meta
        • Package.xml
      • Resources
        • Private
          • Layouts
            • Index.html
          • Templates
            • Event
              • Index.html
        • Public





Setting the namespace is the first thing you have to do in every class. This has to be done in every php file in your complete project. Next step, add a default action, in this case it is the indexAction.


Define a route for the package. In this case, the uriPattern is empty so every request should match. We also define a default controller/action in the Routes.yaml




Define your layout here. This file will be wrapped around each of you templates. Define your body-tag and head-tag here and tell Flow to render the content inside.

<f:base> is used to set the base URL.


The template for the default action. The naming of the path and file has to match the controller and the action. So the controller name is event, means that the folder has to be named “Event”.

The action name is index, so the template file has to be called “Index.html”.

If we add another action later, for example listAction, we have to create a file List.html for this action then.

 Final Step

The package is finished now. There are to things left to do before we can start.

1. Tell FLOW3 that there exists a package with the name Events and activate the package. (/path/to/webroot/Configuration/PackageStates.php)

2. Tell FLOW3 where to find the package and for that we have to edit the Routes.yaml (/path/to/webroot/Configuration/Routes.yaml)



If you come from TYPO3, what I think is highly possible, this file is like ext_emconf.php, where you can that the package name and the version number.

Step 1 – Finished

If you call your URL now, you should see the content from the file Index.html in your Templates folder.

2 thoughts on “Kickstart a package

  1. Mario Delin

    Can you please publish this example as ZIP file? That would help me a lot. Thank you

Comments are closed.