### Setup All Caches Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/CommandReference.md Invokes the setup() method on all configured CacheBackends that implement the WithSetupInterface. Exits with code 1 if any setup fails. ```bash ./flow cache:setupall ``` -------------------------------- ### Setup a Specific Cache Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/CommandReference.md Invokes the setup() method on a configured CacheBackend if it implements the WithSetupInterface, to set up and validate the backend. ```bash ./flow cache:setup --cache-identifier "Flow_Core" ``` -------------------------------- ### Package-Level Settings.yaml Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Configuration.md An example of a package-level Settings.yaml file, used for defining user-level settings. ```yaml # # # Settings Configuration for the Neos.Viewhelpertest Package # ``` -------------------------------- ### Example Middleware Output Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Http.md This is an example of the output from the `middleware:list` command, showing the order and class names of configured middlewares. ```text Currently configured middlewares: +----+---------------------+---------------------------------------------------------+ | # | Name | Class name | +----+---------------------+---------------------------------------------------------+ | 1 | standardsCompliance | Neos\Flow\Http\Middleware\StandardsComplianceMiddleware | | 2 | trustedProxies | Neos\Flow\Http\Middleware\TrustedProxiesMiddleware | | 3 | session | Neos\Flow\Http\Middleware\SessionMiddleware | | 4 | ajaxWidget | Neos\FluidAdaptor\Core\Widget\AjaxWidgetMiddleware | | 5 | routing | Neos\Flow\Mvc\Routing\RoutingMiddleware | | 6 | poweredByHeader | Neos\Flow\Http\Middleware\PoweredByMiddleware | | 7 | flashMessages | Neos\Flow\Mvc\FlashMessage\FlashMessageMiddleware | | 8 | parseBody | Neos\Flow\Http\Middleware\RequestBodyParsingMiddleware | | 9 | securityEntryPoint | Neos\Flow\Http\Middleware\SecurityEntryPointMiddleware | | 10 | dispatch | Neos\Flow\Mvc\DispatchMiddleware | +----+---------------------+---------------------------------------------------------+ ``` -------------------------------- ### Install Composer Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Installation.md Download and install the Composer command-line tool. This is a prerequisite for installing Flow. ```sh curl -s https://getcomposer.org/installer | php ``` -------------------------------- ### Global Routes.yaml Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Routing.md Example of a global Routes.yaml file that includes subroutes from a specific package. ```yaml - name: 'My Package' uriPattern: '' subRoutes: 'MyPackageSubroutes': package: 'My.Package' ``` -------------------------------- ### Generate Example Controller and Model with Kickstarter Source: https://github.com/neos/flow/blob/8.3/Documentation/Quickstart/index.md Use the kickstart:actioncontroller command to generate example controllers, models, and related files for a new domain object. Remember to update the database schema afterwards. ```bash $ ./flow kickstart:actioncontroller --generate-actions --generate-related Acme.Demo CoffeeBean Created .../Acme.Demo/Classes/Acme/Demo/Domain/Model/CoffeeBean.php Created .../Acme.Demo/Tests/Unit/Domain/Model/CoffeeBeanTest.php Created .../Acme.Demo/Classes/Acme/Demo/Domain/Repository/CoffeeBeanRepository.php Created .../Acme.Demo/Classes/Acme/Demo/Controller/CoffeeBeanController.php Omitted .../Acme.Demo/Resources/Private/Layouts/Default.html Created .../Acme.Demo/Resources/Private/Templates/CoffeeBean/Index.html Created .../Acme.Demo/Resources/Private/Templates/CoffeeBean/New.html Created .../Acme.Demo/Resources/Private/Templates/CoffeeBean/Edit.html Created .../Acme.Demo/Resources/Private/Templates/CoffeeBean/Show.html As new models were generated, do not forget to update the database schema with the respective doctrine:* commands. ``` -------------------------------- ### YAML Configuration Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Configuration.md Example of Neos Flow YAML configuration, demonstrating indentation rules and specific settings. ```yaml Neos: Viewhelpertest: includeViewHelpers: [alias, base] xhprof: rootDirectory: '' # path to the XHProf library outputDirectory: '%FLOW_PATH_DATA%Temporary/Viewhelpertest/XHProf/' # output directory profilingTemplatesDirectory: '%FLOW_PATH_DATA%Temporary/Viewhelpertest/Fluidtemplates/' ``` -------------------------------- ### Execute Setup Command Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Controller.md This command is used to set up initial data, such as creating a blog with a specified title. ```none ./flow blog:setup "My Blog" ``` -------------------------------- ### Interface Introduction Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.md Introduces a new interface to a class using the @Flow Introduce annotation. This example shows how to add Example\MyPackage\NewInterface to Example\MyPackage\OldClass and implement its methods. ```php namespace Example\MyPackage; use Neos\Flow\AOP\JoinPointInterface; /** * An aspect for demonstrating introductions * * Introduces Example\MyPackage\NewInterface to the class Example\MyPackage\OldClass: * * @Flow\Introduce("class(Example\MyPackage\OldClass)", interfaceName="Example\MyPackage\NewInterface") * @Flow\Aspect */ class IntroductionAspect { /** * Around advice, implements the new method "newMethod" of the * "NewInterface" interface * * @Flow\Around("method(Example\MyPackage\OldClass->newMethod())") */ public function newMethodImplementation(JoinPointInterface $joinPoint): int { // We call the advice chain, in case any other advice is declared for // this method, but we don't care about the result. $someResult = $joinPoint->getAdviceChain()->proceed($joinPoint); $a = $joinPoint->getMethodArgument('a'); $b = $joinPoint->getMethodArgument('b'); return $a + $b; } } ``` -------------------------------- ### Trait Introduction Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.md Introduces a trait to a class using the @Flow\Introduce annotation with the traitName argument. This example adds Example\MyPackage\SomeTrait to Example\MyPackage\MyClass. ```php namespace Example\MyPackage; use Neos\Flow\Annotations as Flow; /** * An aspect for demonstrating trait introduction * * Introduces Example\MyPackage\SomeTrait to the class Example\MyPackage\MyClass: * * @Flow\Introduce("class(Example\MyPackage\MyClass)", traitName="Example\MyPackage\SomeTrait") * @Flow\Aspect */ class TraitIntroductionAspect { } ``` -------------------------------- ### f:render Partial Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.md Shows how to render a partial ViewHelper with optional arguments. ```php ``` ```php the content of the partial "SomePartial". The content of the variable {someVariable} will be available in the partial as {foo} ``` -------------------------------- ### Command Line Example Source: https://github.com/neos/flow/blob/8.3/Documentation/StyleGuide/FontConventions.md Examples intended for command-line execution are presented in a distinct text block. Users should omit the '$' symbol, which represents the Unix prompt. ```bash $ ./flow kickstart:package Acme.MyPackage Created .../Acme.Test/Classes/Acme/Test/Controller/StandardController.php ``` -------------------------------- ### Minimal Package.php Bootstrap Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PackageManagement.md Example of a minimal Classes/Package.php file for a Neos/Flow package. It registers a request handler and connects a signal to a slot during the bootstrap process. ```php registerRequestHandler(new \Acme\Demo\Quux\RequestHandler($bootstrap)); $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect(\Neos\Flow\Mvc\Dispatcher::class, 'afterControllerInvocation', \Acme\Demo\Baz::class, 'fooBar'); } } ?> ``` -------------------------------- ### Initialize Configuration Without Cache Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ChangeLogs/834.md Example of how to initialize the configuration manager without caching at runtime. This is useful for specific boot-time scenarios. ```php Scripts::initializeConfiguration($this->bootstrap, false); ``` -------------------------------- ### Basic Command Controller Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Controller.md A minimal Flow Command Controller class with a single example command. It demonstrates how to define commands with required and optional arguments and includes documentation for help screens. ```php outputLine('You called the example command and passed "%s" as the first argument.', array($requiredArgument)); } } ``` -------------------------------- ### All Caps Example Source: https://github.com/neos/flow/blob/8.3/Documentation/StyleGuide/StyleAndUsage.md An example of all caps capitalization. Do not use for emphasis. ```text THIS LINE PROVIDES AN EXAMPLE OF ALL CAPS. ``` -------------------------------- ### Settings.yaml Example for Object Injection Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md A sample Settings.yaml file demonstrating how to define the object path used for injection. ```yaml MyCompany: MyPackage: fooStuff: barImplementation: 'MyCompany\MyPackage\Bars\ASpecialBar' ``` -------------------------------- ### f:inline ViewHelper Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.md Shows how to use the f:inline ViewHelper to render Fluid code stored in a variable. ```php $view->assign('variable', 'value of my variable'); $view->assign('code', 'My variable: {variable}'); ``` ```php {code -> f:inline()} ``` ```php My variable: value of my variable ``` -------------------------------- ### Constructor Injection Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md An example of a class 'Foo' that depends on an interface 'BarInterface', demonstrating constructor injection. The dependency is type-hinted in the constructor. ```php namespace MyCompany\MyPackage; class Foo { protected $bar; public function __construct(\MyCompany\MyPackage\BarInterface $bar) { $this->bar = $bar; } public function doSomething() { $this->bar->doSomethingElse(); } } ``` -------------------------------- ### Example of I18n.translate() with Dot Notation for Source Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ReleaseNotes/720.md This example shows the older way of passing the path to the translation file instead of dot notation. ```php ${I18n.translate('progress', null, {solved: this.checkedElementsCount, total: this.checkboxCount}, 'NodeTypes/Content/Todo/Container', 'Muensmedia.DistributionPackage')} ``` -------------------------------- ### Example Migration Status Report Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Persistence.md An example of the output from the `flow:doctrine:migrationstatus` command, illustrating the detailed information provided about the database schema and migration versions. ```text +----------------------+-------------------------------------------+------------------------------------------------------------------------+ | Configuration | +----------------------+-------------------------------------------+------------------------------------------------------------------------+ | Storage | Type | Doctrine\Migrations\Metadata\Storage\TableMetadataStorageConfiguration | | | Table Name | flow_doctrine_migrationstatus | | | Column Name | version | |-------------------------------------------------------------------------------------------------------------------------------------------| | Database | Driver | Doctrine\DBAL\Driver\PDO\MySQL\Driver | | | Name | flowdev | |-------------------------------------------------------------------------------------------------------------------------------------------| | Versions | Previous | Neos\Flow\Persistence\Doctrine\Migrations\Version20180827132710 | | | Current | Neos\Flow\Persistence\Doctrine\Migrations\Version20200908155620 | | | Next | Already at latest version | | | Latest | Neos\Flow\Persistence\Doctrine\Migrations\Version20200908155620 | |-------------------------------------------------------------------------------------------------------------------------------------------| | Migrations | Executed | 27 | | | Executed Unavailable | 0 | | | Available | 27 | | | New | 0 | |-------------------------------------------------------------------------------------------------------------------------------------------| | Migration Namespaces | Neos\Flow\Persistence\Doctrine\Migrations | /Users/karsten/Sites/flowdev/Data/DoctrineMigrations | +----------------------+-------------------------------------------+------------------------------------------------------------------------+ ``` -------------------------------- ### Property Introduction Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.md Introduces a new property to a class using the @Flow\Introduce annotation on a protected property within an aspect. This example adds a 'subtitle' property to Example\Blog\Domain\Model\Post. ```php namespace Example\MyPackage; use Neos\Flow\Annotations as Flow; /** * An aspect for demonstrating property introductions * * @Flow\Aspect */ class PropertyIntroductionAspect { /** * @var string * @Doctrine\ORM\Mapping\Column(length=40) * @Flow\Introduce("class(Example\Blog\Domain\Model\Post)") */ protected $subtitle; } ``` -------------------------------- ### Xdebug Path Mapping Example Configuration Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ChangeLogs/8319.md This example shows the format of the .xdebug/flow.map file generated by Flow for Xdebug path mapping. It includes configuration directives for Xdebug in php.ini. ```yaml # Created by Flow Framework during compile time proxy generation. # # Ensure you are using xdebug >= v3.5 with enabled path mapping. # Configuration in your php.ini: # xdebug.mode = develop # xdebug.path_mapping = 1 # # ---------------------------------------------------------------- # Last update: 2026-03-03 22:49:57 remote_prefix:/var/www/html/Data/Temporary/Development/SubContextDdev/Cache/Code/Flow_Object_Classes/ local_prefix:/var/www/html/ Neos_Diff_Diff.php = Packages/Neos/Neos.Diff/Classes/Diff.php Neos_Diff_SequenceMatcher.php = Packages/Neos/Neos.Diff/Classes/SequenceMatcher.php Neos_Diff_Renderer_Html_HtmlInlineRenderer.php = Packages/Neos/Neos.Diff/Classes/Renderer/Html/HtmlInlineRenderer.php Neos_Diff_Renderer_Html_HtmlSideBySideRenderer.php = Packages/Neos/Neos.Diff/Classes/Renderer/Html/HtmlSideBySideRenderer.php ... ``` -------------------------------- ### f:render Section Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/TYPO3FluidViewHelperReference.md Demonstrates rendering a specific section within a template using the f:render ViewHelper. ```php This is a section. {foo} ``` ```php the content of the section "someSection". The content of the variable {someVariable} will be available in the partial as {foo} ``` -------------------------------- ### Example Usage of Exceeding Arguments Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/CommandLine.md Demonstrates how to invoke a command with exceeding arguments and the expected output. ```none $ ./flow foo:processword --operation lowercase These Are The Words these are the words ``` -------------------------------- ### Placeholder Syntax Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Internationalization.md Illustrates the basic syntax for placeholders within translated messages, including optional formatters and attributes. ```none {0} {0,number,decimal} {1,datetime,time,full} ``` -------------------------------- ### Extend ExtJS Data Store Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/CodingGuideLines/JavaScript.md Example demonstrating how to extend an ExtJS data store by creating a new class and registering it. ```php Neos.Neos.Content.DummyStore = Ext.extend(Ext.data.Store, { constructor: function(cfg) { cfg = cfg || {}; var config = Ext.apply( { autoLoad: true }, cfg ); Neos.Neos.Content.DummyStore.superclass.constructor.call( this, config ); } }); Ext.reg('Neos.Neos.Content.DummyStore', Neos.Neos.Content.DummyStore); ``` -------------------------------- ### Build Default Property Mapping Configuration Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PropertyMapping.md Instantiate PropertyMappingConfigurationBuilder and build a default configuration. This is the recommended way to start. ```php // Here $propertyMappingConfigurationBuilder is an instance of // \Neos\Flow\Property\PropertyMappingConfigurationBuilder $propertyMappingConfiguration = $propertyMappingConfigurationBuilder->build(); // modify $propertyMappingConfiguration here // pass the configuration to convert() $propertyMapper->convert($source, $targetType, $propertyMappingConfiguration); ``` -------------------------------- ### Nesting Object Configuration Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md Demonstrates how to configure nested object structures for dependency injection, such as a cache object with its own backend configuration. ```yaml MyCompany\MyPackage\Controller\StandardController: properties: cache: object: name: 'Neos\Cache\VariableCache' arguments: 1: value: MyCache 2: object: name: 'Neos\Cache\Backend\File' properties: cacheDirectory: value: /tmp/ ``` -------------------------------- ### DateTimeRangeValidator: Date Between Boundaries Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ValidatorReference.md Validates if a date falls within a specific start and end date. ```yaml earliestDate: 2007-03-01T13:00:00Z latestDate: 2007-03-30T13:00:00Z ``` -------------------------------- ### Configure PSR-15 Middleware Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ReleaseNotes/700.md Configure a PSR-15 middleware in the Flow settings. This example adds a response time middleware to the start of the chain. ```yaml Neos: Flow: http: middlewares: 'ResponseTime': middleware: 'Middlewares\ResponseTime' position: start ``` -------------------------------- ### Application Identifier Configuration Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Caching.md Example configuration to set a custom application identifier for cache backends. This is useful for differentiating cache entries across multiple installations or Flow contexts. ```yaml Neos: Flow: cache: applicationIdentifier: 'some-unique-system-identifier' ``` -------------------------------- ### Setup Command Controller with Repositories Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Controller.md A Flow Command Controller with a 'setupCommand' that creates a new blog and a sample post. It demonstrates injecting repositories and handling an optional reset flag. ```php blogRepository->removeAll(); $this->postRepository->removeAll(); } $blog = new Blog($blogTitle); $blog->setDescription('A blog about Foo, Bar and Baz.'); $this->blogRepository->add($blog); $post = new Post(); $post->setBlog($blog); $post->setAuthor('John Doe'); $post->setSubject('Example Post'); $post->setContent('Lorem ipsum dolor sit amet, consectetur adipisicing elit.' . chr(10) . 'Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.'); $this->postRepository->add($post); $this->outputLine('Successfully created a blog "%s"', [$blogTitle]); } } ``` -------------------------------- ### Reference Subroutes in Global Routing Setup Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Routing.md Example of referencing subroutes defined in a package within the global `Routes.yaml` file. Parts of the URI pattern are enclosed in angle brackets to indicate subroute references. ```yaml - name: 'Demo SubRoutes' uriPattern: 'demo/(.{@format})' defaults: '@package': 'My.Demo' '@format': 'html' subRoutes: 'DemoSubroutes': package: 'My.Demo' ``` -------------------------------- ### Combined connect() and wire() in Boot Method Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/SignalsAndSlots.md Demonstrates wiring both a standard slot and a dedicated slot for the same signal within a package's boot method. This shows flexibility in handling signals. ```php /** * Boot the package. We wire some signals to slots here. */ public function boot(\Neos\Flow\Core\Bootstrap $bootstrap): void { $dispatcher = $bootstrap->getSignalSlotDispatcher(); $dispatcher->connect( \Some\Package\Controller\CommentController::class, 'commentCreated', \Some\Package\Service\Notification::class, 'sendNewCommentNotification' ); $dispatcher->wire( \Some\Package\Controller\CommentController::class, 'commentCreated', \Some\Package\Service\Notification::class, 'dedicatedSendNewCommentNotificationSlot' ); } ``` -------------------------------- ### Install Package using Composer Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PackageManagement.md Install a package from Packagist using the 'composer require' command. Ensure Composer is installed first. ```bash composer require ``` -------------------------------- ### Kickstart Blog Repository Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/ModelAndRepository.md Generates a basic repository for the Blog model. This command is used to quickly set up the initial repository structure. ```bash ./flow kickstart:repository Acme.Blog Blog ``` -------------------------------- ### Title-Style Capitalization Example Source: https://github.com/neos/flow/blob/8.3/Documentation/StyleGuide/StyleAndUsage.md An example of title-style capitalization. ```text This Line Provides an Example of Title-Style Capitalization. ``` -------------------------------- ### Sentence-Style Capitalization Example Source: https://github.com/neos/flow/blob/8.3/Documentation/StyleGuide/StyleAndUsage.md An example of sentence-style capitalization. ```text This line provides an example of sentence-style capitalization. ``` -------------------------------- ### List All Available Commands Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/CommandLine.md Use the 'help' command to list all available commands across all packages, including core and third-party commands. ```bash $ ./flow help Flow 2.x.x ("Development" context) usage: ./flow The following commands are currently available: PACKAGE "Neos.Flow": ---------------------------------------------------------------------------- * flow:cache:flush Flush all caches cache:warmup Warm up caches configuration:show Show the active configuration settings configuration:validate Validate the given configuration configuration:generateschema Generate a schema for the given configuration or YAML file. ... ``` -------------------------------- ### WebRedirect Entry Point Configuration Options (PHP Example) Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Security.md Illustrates the configuration options for the WebRedirect entry point, showing how to specify a URI or route values for redirection. Prior to Flow 1.2, only 'uri' was supported. ```php uri: login/ ``` ```php routeValues: '@package': 'Your.Package' '@controller': 'Authenticate' '@action': 'login' ``` -------------------------------- ### Eel Expression Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Eel.md An example of an Eel expression that uses logical operators and a custom function. ```php 'foo.bar == "Test" || foo.baz == "Test" || reverse(foo).bar == "Test"' ``` -------------------------------- ### Create and Migrate Database Schema Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Configuration.md Use './flow doctrine:create' followed by './flow doctrine:migrationversion --add --version all' for initial database setup. This is a destructive operation and should only be used for new databases. ```bash ./flow doctrine:create && ./flow doctrine:migrationversion --add --version all ``` -------------------------------- ### Kickstart a New Flow Package Source: https://github.com/neos/flow/blob/8.3/Documentation/Quickstart/index.md Use the kickstart:package command to generate a new application package. This command creates the basic directory structure and sample files for your package. ```bash $ ./flow kickstart:package Acme.Demo ``` ```text Created .../Acme.Demo/Classes/Acme/Demo/Controller/StandardController.php Created .../Acme.Demo/Resources/Private/Layouts/Default.html Created .../Acme.Demo/Resources/Private/Templates/Standard/Index.html ``` ```text Packages/ Application/ Acme.Demo/ Classes/Acme/Demo/ Configuration/ Documentation/ Meta/ Resources/ Tests/ ``` -------------------------------- ### Install PSR-15 Middleware Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ReleaseNotes/700.md Install a PSR-15 compatible middleware using Composer. This is used to extend the HTTP request handling. ```bash composer require middlewares/response-time ``` -------------------------------- ### Basic Form GET Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/FluidAdaptorViewHelperReference.md Generates a basic HTML form with the GET method. The action attribute is set to the provided value. ```php ... ``` ```html
...
``` -------------------------------- ### Kickstart Blog Model Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/ModelAndRepository.md Use the Flow kickstart command to generate a new model. Specify the package, model name, and properties with their types. ```bash ./flow kickstart:model Acme.Blog Blog title:string \ description:string 'posts:\Doctrine\Common\Collections\Collection' ``` -------------------------------- ### Example Package Type Declaration Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PackageManagement.md This is an example of a package type declaration within a manifest file, indicating the package's category. ```json "type": "neos-acme" ``` -------------------------------- ### Accessing the Flow Welcome Screen Source: https://github.com/neos/flow/blob/8.3/Documentation/Quickstart/index.md Verify your installation by accessing the Flow welcome screen via a web browser. Ensure your web server is configured correctly. ```text http://quickstart/ ``` ```text http://localhost/Quickstart/Web/ ``` -------------------------------- ### Show All Configuration Settings Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/CommandReference.md Displays all active configuration settings for the current context. Useful for debugging and understanding the application's configuration. ```bash ./flow configuration:show ``` -------------------------------- ### Acme.Package XLIFF Override Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Internationalization.md Example of an XLIFF file from a custom package (Acme.Package) that overrides a translation from Neos.Flow. It uses the 'original' and 'product-name' attributes for identification. ```xml Whatever translation more appropriate to your domain comes to your mind. ``` -------------------------------- ### Create XLIFF Translation Files Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ReleaseNotes/410.md Use the kickstart:translation command to generate initial XLIFF translation files for a specified package and language. Check the generated files in Packages/Sites//Resources/Private/Translations. ```bash ./flow kickstart:translation --package-key Neos.Demo --language-key de ``` -------------------------------- ### Neos.Flow Package XLIFF Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Internationalization.md Example of a default XLIFF file for the Neos.Flow package, defining a validation error message. This file is located in the framework's resources. ```xml Only regular characters (a to z, umlauts, ...) and numbers are allowed. ``` -------------------------------- ### Create Username/Password Account Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Security.md Use the AccountFactory to create a new account with a username, password, roles, and authentication provider. The account is then added to the account repository. This example assumes accountFactory and accountRepository are available via dependency injection. ```php $identifier = 'andi'; $password = 'secret'; $roles = array('Acme.MyPackage:Administrator'); $authenticationProviderName = 'DefaultProvider'; $account = $this->accountFactory->createAccountWithPassword($identifier, $password, $roles, $authenticationProviderName); $this->accountRepository->add($account); ``` -------------------------------- ### Example Exception Log Output Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Logging.md This is an example of how an exception is logged by Flow, including the exception message, stack trace, HTTP request details, and PHP process information. ```text Exception: Argument 1 passed to Neos\Flow\Http\Middleware\MiddlewaresChain_Original::__construct() must be of the type string, array given 10 Neos\Flow\Http\Middleware\MiddlewaresChain_Original::__construct(array|0|, array|3|) 9 call_user_func_array("parent::__construct", array|2|) 8 Neos\Flow\Http\Middleware\MiddlewaresChain::__construct(array|0|, array|3|) 7 Neos\Flow\Http\Middleware\MiddlewaresChainFactory_Original::create(array|3|, array|0|) 6 call_user_func_array(array|2|, array|2|) 5 Neos\Flow\ObjectManagement\ObjectManager::buildObjectByFactory("Neos\Flow\Http\Middleware\MiddlewaresChain") 4 Neos\Flow\ObjectManagement\ObjectManager::get("Neos\Flow\Http\Middleware\MiddlewaresChain") 3 Neos\Flow\Http\RequestHandler::resolveDependencies() 2 Neos\Flow\Http\RequestHandler::handleRequest() 1 Neos\Flow\Core\Bootstrap::run() HTTP REQUEST: 127.0.0.1:8081keep-aliveno-cacheno-cacheimageMozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.361image/webp,image/apng,image/*,*/*;q=0.8same-originno-corshttp://127.0.0.1:8081/flow/welcomegzip, deflate, brde-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 PHP PROCESS: Inode: PID: 2296 UID: 1 GID: 1 User: ``` -------------------------------- ### Map Domains to Localhost Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Installation.md Add this line to your system's hosts file to map the defined domain names (tutorial.local and dev.tutorial.local) to your local machine's IP address. This is necessary for accessing the virtual hosts locally. ```php 127.0.0.1 tutorial.local dev.tutorial.local ``` -------------------------------- ### Get Logger Instance using PsrLoggerFactory Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md Obtain a logger instance by calling the 'get' method on the PsrLoggerFactory. This is useful for complex logger configurations involving frontends, backends, and options. ```php $myCache = $loggerFactory->get('systemLogger'); ``` -------------------------------- ### Example of Lazy Dependency Injection with Property Injection Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md Demonstrates how a dependency is injected lazily using the @Flow\Inject annotation. This example shows a common scenario where a dependency is passed to another method. ```php namespace MyCompany\MyPackage; use Neos\Flow\Annotations as Flow; class Foo { /** * A dependency, injected lazily: * * @var \MyCompany\MyPackage\BarInterface * @Flow\Inject */ protected $bar; ... public function doSomething() { $this->baz->doSomethingElse($this->bar); } } class Baz { public function doSomethingElse(Bar $bar) { ... } } ``` -------------------------------- ### List All Available Flow Commands Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Kickstart.md Use the 'help' command to get an overview of all commands available in the Flow framework, categorized by package. ```none ./flow help Flow 3.0.0 ("Development" context) usage: ./flow The following commands are currently available: PACKAGE "NEOS.FLOW": ------------------------------------------------------------------------------- * flow:cache:flush Flush all caches cache:warmup Warm up caches configuration:show Show the active configuration settings configuration:listtypes List registered configuration types configuration:validate Validate the given configuration configuration:generateschema Generate a schema for the given configuration or YAML file. * flow:core:setfilepermissions Adjust file permissions for CLI and web server access * flow:core:migrate Migrate source files as needed * flow:core:shell Run the interactive Shell database:setcharset Convert the database schema to use the given character set and collation (defaults to utf8mb4 and utf8mb4_unicode_ci). doctrine:validate Validate the class/table mappings doctrine:create Create the database schema doctrine:update Update the database schema doctrine:entitystatus Show the current status of entities and mappings doctrine:dql Run arbitrary DQL and display results doctrine:migrationstatus Show the current migration status doctrine:migrate Migrate the database schema doctrine:migrationexecute Execute a single migration doctrine:migrationversion Mark/unmark a migration as migrated doctrine:migrationgenerate Generate a new migration help Display help for a command package:create Create a new package package:delete Delete an existing package package:activate Activate an available package package:deactivate Deactivate a package package:list List available packages package:freeze Freeze a package package:unfreeze Unfreeze a package package:refreeze Refreeze a package resource:publish Publish resources resource:clean Clean up resource registry routing:list List the known routes security:importpublickey Import a public key security:importprivatekey Import a private key security:showeffectivepolicy Shows a list of all defined privilege targets and the effective permissions for the given groups. security:showunprotectedactions Lists all public controller actions not covered by the active security policy security:showmethodsforprivilegetarget Shows the methods represented by the given security privilege target server:run Run a standalone development server typeconverter:list Lists all currently active and registered type converters PACKAGE "NEOS.KICKSTARTER": ------------------------------------------------------------------------------- kickstart:package Kickstart a new package kickstart:actioncontroller Kickstart a new action controller kickstart:commandcontroller Kickstart a new command controller kickstart:model Kickstart a new domain model kickstart:repository Kickstart a new domain repository * = compile time command See './flow help ' for more information about a specific command. ``` -------------------------------- ### Valid PHP Commit Message Examples Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/CodingGuideLines/PHP.md Provides examples of good and bad commit message subject lines, highlighting correct prefix usage, present tense, and breaking change indicators. ```php Introduce xyz service // BAD, missing code prefix BUGFIX: Fixed bug xyz // BAD, subject should be written in present tense WIP !!! TASK: A breaking change // BAD, subject has to start with [!!!] for breaking changes BUGFIX: Make SessionManager remove expired sessions // GOOD, the line explains what the change does, not what the bug is about (this should be explained in the following lines and in the related bug tracker ticket) ``` -------------------------------- ### Match configuration settings Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/AspectOrientedProgramming.md Use setting() to match if a configuration option is set to true or equals a specified value. This allows for configurable advices. ```php setting(my.configuration.option) ``` ```php setting(my.configuration.option = 'AOP is cool') ``` -------------------------------- ### Generated Migration Class Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Persistence.md An example of an auto-generated migration class. It includes methods for `up` and `down` operations, with placeholders for schema modifications. Ensure to adapt the SQL statements and platform checks to your specific needs. ```php abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql("CREATE TABLE party_abstractparty (…) ENGINE = InnoDB"); } public function down(Schema $schema) : void { // this down() migration is auto-generated, please modify it to your needs $this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.'); $this->addSql("DROP TABLE party_abstractparty"); } } ``` -------------------------------- ### Instantiate a Ship Object Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartI/Object-OrientedProgramming.md Creates a new 'Ship' object and displays its initial state using var_dump(). This demonstrates the basic process of object instantiation. ```php $fidelio = new Ship(); // Display the object var_dump($fidelio); ``` -------------------------------- ### Verify Package Creation Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartII/Kickstart.md After creating a package, use this command to list all generated files and directories within the new package structure. ```bash cd Packages/Application/ find Acme.Blog ``` -------------------------------- ### Malicious Data Payload Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PropertyMapping.md An example of a malicious data payload an attacker might submit to exploit recursive property mapping. This payload attempts to create a `Role` object with elevated privileges. ```php array( 'username' => 'mynewuser', 'role' => array( 'name' => 'superuser', 'admin' => 1 ) ); ``` -------------------------------- ### Sample Class with Lifecycle Methods Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md Illustrates the usage of various object lifecycle methods: __construct(), injectBar(), setIdentifier(), initializeObject(), shutdownObject(), and __destruct(). ```php class Foo { protected $bar; protected $identifier = 'Untitled'; public function __construct() { echo ('Constructing object ...'); } public function injectBar(\MyCompany\MyPackage\BarInterface $bar) { $this->bar = $bar; } public function setIdentifier($identifier) { $this->identifier = $identifier; } public function initializeObject() { echo ('Initializing object ...'); } public function shutdownObject() { echo ('Shutting down object ...') } public function __destruct() { echo ('Destructing object ...'); } } ``` ```php Constructing object ... Initializing object ... Shutting down object ... Destructing object ... ``` -------------------------------- ### Route with Dynamic Action Part Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Routing.md Sets up a route where the action is determined dynamically from the URI, using the pattern 'my/demo/{@action}'. The package and controller are fixed. ```yaml - name: 'Dynamic demo route' uriPattern: 'my/demo/{@action}' defaults: '@package': 'My.Demo' '@controller': 'Product' ``` -------------------------------- ### Get Object using Custom Factory via ObjectManager Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ObjectManagement.md Instantiate an object that uses a custom factory by calling the 'get' method on the ObjectManager. Arguments defined in the object configuration are automatically passed to the factory method. ```php $myCache = $objectManager->get(\Neos\Flow\Log\PsrSystemLoggerInterface::class); ``` -------------------------------- ### Configure Master/Slave Database Connection Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Persistence.md Configure Neos Flow to use a master/slave database replication setup by specifying the 'wrapperClass' and connection details in your packages' Settings.yaml. This setup uses a slave for reading queries until a write query is executed. ```yaml Neos: Flow: persistence: backendOptions: wrapperClass: 'Doctrine\DBAL\Connections\MasterSlaveConnection' master: host: '127.0.0.1' # adjust to your master database host dbname: 'master' # adjust to your database name user: 'user' # adjust to your database user password: 'pass' # adjust to your database password slaves: slave1: host: '127.0.0.1' # adjust to your slave database host dbname: 'slave1' # adjust to your database name user: 'user' # adjust to your database user password: 'pass' # adjust to your database password ``` -------------------------------- ### Advanced Entity Privilege Matcher Examples Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/Security.md Demonstrates advanced EEL expressions for entity privilege matchers, including matching on related entity properties, comparing with global objects, and checking against collections. These examples are taken from functional tests. ```yaml 'Neos\Flow\Security\Authorization\Privilege\Entity\Doctrine\EntityPrivilege': 'Acme.MyPackage.RelatedStringProperty': matcher: 'isType("Acme\MyPackage\EntityA") && property("relatedEntityB.stringValue") == "Admin"' 'Acme.MyPackage.RelatedPropertyComparedWithGlobalObject': matcher: 'isType("Acme\MyPackage\EntityA") && property("relatedEntityB.ownerAccount") != "context.securityContext.account" && property("relatedEntityB.ownerAccount") != null' 'Acme.MyPackage.CompareStringPropertyWithCollection': matcher: 'isType("Acme\MyPackage\EntityC") && property("simpleStringProperty").in(["Andi", "Robert", "Karsten"])' 'Acme.MyPackage.ComparingWithObjectCollectionFromGlobalObjects': matcher: 'isType("Acme\MyPackage\EntityC") && property("relatedEntityD").in("context.someGloablObject.someEntityDCollection")' ``` -------------------------------- ### Access Properties and Call Methods Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartI/Object-OrientedProgramming.md Demonstrates how to set object properties (like 'name') and call object methods (like 'startEngine()') using the arrow operator (->). This is the standard way to interact with object members. ```php $ship = new Ship(); $ship->name = "FIDELIO"; echo "The ship's Name is ". $ship->name; $ship->startEngine(); $ship->moveTo('Bahamas'); $ship->stopEngine(); ``` -------------------------------- ### Flow CLI Help Command Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartV/ChangeLogs/739.md Demonstrates how the `./flow help` command now displays argument names as descriptions when no @param annotation is found, preventing errors. ```bash ./flow help command:name ``` -------------------------------- ### EmailAddress Value Object Example Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/PropertyMapping.md Example of a Value Object for an email address. It includes a private constructor with validation and a static `fromString` method for creation. Use `@Flow Proxy(false)` annotation for Value Objects with private constructors. ```php /** * @Flow\Proxy(false) */ final class EmailAddress { private function __construct( public readonly string $value, ) { if (filter_var($value, FILTER_VALIDATE_EMAIL) === false) { throw new \InvalidArgumentException(sprintf('"%s" is not a valid email address', $this->value)); } } public static function fromString(string $value): self { return new self($value); } } ``` -------------------------------- ### JSON View Configuration Options Source: https://github.com/neos/flow/blob/8.3/Documentation/TheDefinitiveGuide/PartIII/ModelViewController.md Example configuration array for JSON View, demonstrating options like '_only', '_exclude', '_descend', '_descendAll', '_exposeObjectIdentifier', and '_exposedObjectIdentifierKey'. ```php [ 'value' => [ // only render the "name" property of value '_only' => ['name'] ), 'anothervalue' => [ // render every property except the "password" // property of anothervalue '_exclude' => ['password'] // we also want to include the sub-object // "address" as nested JSON object '_descend' => [ 'address' => [ // here, you can again configure // _only, _exclude and _descend if needed ] ] ], 'arrayvalue' => [ // descend into all array elements '_descendAll' => [ // here, you can again configure _only, // _exclude and _descend for each element ] ], 'valueWithObjectIdentifier' => [ // by default, the object identifier is not // included in the output, but you can enable it '_exposeObjectIdentifier' => true, // the object identifier should not be rendered // as "__identity", but as "guid" '_exposedObjectIdentifierKey' => 'guid' ] ] ```