PHPackages                             vinou/site-builder - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. vinou/site-builder

ActiveLibrary

vinou/site-builder
==================

PHP library to generate template based webpages with dynamic content from the Vinou Plattform

3.1.5(10mo ago)2989GPL-2.0+PHPPHP &gt;=7.2

Since Mar 29Pushed 10mo ago3 watchersCompare

[ Source](https://github.com/vinou-platform/sitebuilder)[ Packagist](https://packagist.org/packages/vinou/site-builder)[ Docs](http://doc.vinou.de)[ RSS](/packages/vinou-site-builder/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (11)Versions (98)Used By (0)

Vinou Site-Builder
==================

[](#vinou-site-builder)

The Vinou Site-Builder is a PHP library that easily combine a basic php routing configured in a routes.yml file with Twig template rendering. The library also provides the possible to call libraries as data processors and pipe the result directly within the twig template.

### Table of contents

[](#table-of-contents)

- [Typical project structure](#typical-project-structure)
- [Installation (typical)](#installation-via-typical-project-structure)
- [Route configuration](#route-configuration)
    1. [General route parameters](#1-general-route-parameters)
    2. [Load sitemap configuration)](#2-load-sitemap-configuration-for-route)
    3. [Use dataProcessing](#3-use-dataprocessing)
    4. [Registered processors](#4-registered-processors)
    5. [Register your own processor](#5-register-your-own-processor)
- [Classlist](#classlist)
- [Provider](#provider)

Typical project structure
-------------------------

[](#typical-project-structure)

FileDescriptioncomposer.jsonMain composer configuration to combine the whole site into one packageconfig/settings.ymlAll settings regarding SiteBuilder and ApiConnectorconfig/routes.ymlAll routes that are dynamically generated and rendered via sitebuilderconfig/mail.ymlMail settings including smtp credentialsweb/index.phpMain instatiationweb/.htaccessHtaccess configuration mainly to link all requests to index.phpweb/Resources/LayoutsLayout folderweb/Resources/Layouts/Default.twigDefault Twig-Layoutweb/Resources/Partials*optional* Partials Folderweb/Resources/Templates/start.twigTemplate for start page**This example project structur can be found inside the repository in the Example/Project folder**

Installation (via typical project structure)
--------------------------------------------

[](#installation-via-typical-project-structure)

This installation guide is based on our preferred project structure. This structure is developed over years and adopted from many OSS projects. Special thanks are going to the great TYPO3 community that we are participating over years and delivers a great knowhow and share ideas over years.

**1. Setup project structure**

```
composer require vinou/site-builder
cp -R vendor/vinou/site-builder/Examples/Project/config ./
cp -R vendor/vinou/site-builder/Examples/Project/web ./
```

**2. Modify your installation**

Required modifications!

- Fill in your Vinou AuthId and token in config/settings.yml you can find them in your [Vinou-Office](https://app.vinou.de)
- Fill in your mail server credentials in config/mail.yml

Optional but typical modifications

- Configure Vinou API-Connector via Vinou constants
- Add basic but needed routes in config/routes.yml

Route configuration
-------------------

[](#route-configuration)

### 1. General route parameters

[](#1-general-route-parameters)

ParameterDefaultOptionsDescriptiontypepage`page`generate page from twig template`redirect`redirect to external or internal pagemethodget`get`page is only callable via GET requests`post`page is only callable via POST requests`all`page is callable by each type of http requeststemplatenot set`Path/to/template.twig`template file to be used for this pageredirectnot set`/route/to/local/page`local page for redirect`http://www.google.de`you can also use URLs for redirectpageTitlenot set`Start page`Title of page shown in title tag and used as variable in templatepublictrue`true`Page always callable`false`Page only callable with Vinou client loginsitemapfalse`true`Page listed in sitemap.xml`false`Page not listed in sitemap.xml*Array*Array of options to generate sitemap entries see sitemap paramaterstwignot set*Array*Array of options that modify twig behaviourdataProcessingnot set*Array*Array of keys that are filled with the result of called functions### 2. Load sitemap configuration for route

[](#2-load-sitemap-configuration-for-route)

**PLEASE NOTICE: to use sitemap parameters your route must contain a variable placeholder**

```
wines/{path_segment}:
  template: 'Wines/detail.twig'
  pageTitle: 'Wine detail page'
  public: true
  sitemap:
    function: getWinesAll
    params:
      lazy: false
      pageSize: 500
    dataKey: 'wines'
  dataProcessing:
    wine: getWine
```

ParameterValue (Example)Descriptionfunction`getWinesAll`function name in Vinou API-Connector that is called to fetch itemsparams*Array*Array of params that are piped into the sitemap rendererparams/lazy*Boolean*load entries recurring, can be useful if huge data is loadedparams/pageSize*Integer*number of entries loaded in one recurring processdataKey`wines`Key in API result that contains the entries to generate different pages### 3. Use dataProcessing

[](#3-use-dataprocessing)

The main principle is that you can define a key that is filled by the result of the function that is called within a specific processor. If no processor is set the Vinou API-Connector is used by default.

**SHORTHAND NOTICE: If you don't need any additional function configuration and want to call an API-Connector function you can define a key directly with the function name**

Example shorthand calls for wines and wineries

```
wines/{path_segment}:
  template: 'Wines/Detail.twig'
  pageTitle: 'wine detail page'
  public: true
  dataProcessing:
    wines: getWinesAll
    wineries: getWineriesAll
```

Example advanced config to combine wines and bundles into one items array

```
wines/{path_segment}:
  template: 'Wines/Detail.twig'
  pageTitle: 'wine detail page'
  public: true
  dataProcessing:
    wines: getWinesAll
    bundles: getBundlesAll
    items:
      processor: 'formatter'
      function: 'mergeData'
      useRouteData: FALSE
      useData:
        - wines
        - bundles
    wineries: getWineriesAll
```

ParameterValue (Example)Descriptionprocessor`formatter`identifier of processor where class is registered (see processor list)class`\Vendor\Namespace\Class`use namespace call to load a class as a processorfunction`getWinesAll`function name in Vinou API-Connector that is called to fetch itemsparams*Array*Array of params that are piped into the functionuseRouteData*Boolean*Set to false is wildcard variables from route should not be piped into the functionuseData*Array*Array of keys that are processed in the same dataProcessing before and should be piped into the functiondataKey`wines`Key in API result that contains the resultgetParams`firstname,lastname`comma separated names of GET variables that should be piped into the functionpostParams`firstname,lastname`comma separated names of POST variables that should be piped into the function### 4. Registered processors

[](#4-registered-processors)

identifierClassAPI available in ProcessorDescription*default*\\Vinou\\ApiConnector\\ApinoBasic Vinou API calls`shop`\\Vinou\\SiteBuilder\\Processors\\ShopyesBasic Shop functions combined with Vinou API`mailer`\\Vinou\\SiteBuilder\\Processors\\MaileryesSend mails from template forms`files`\\Vinou\\SiteBuilder\\Processors\\FilesnoRead local files with meta data`external`\\Vinou\\SiteBuilder\\Processors\\ExternalnoLoad URLs, external files e.g. JSON files`sitemap`\\Vinou\\SiteBuilder\\Processors\\SitemapnoGenerate sitemaps`formatter`\\Vinou\\SiteBuilder\\Processors\\FormatternoCombine and format loaded data### 5. Register your own processor

[](#5-register-your-own-processor)

Create your own processor

```
