Skip to content

Instantly share code, notes, and snippets.

View mneuhaus's full-sized avatar

Marc Neuhaus mneuhaus

View GitHub Profile
@smichaelsen
smichaelsen / packagestates.md
Last active October 12, 2020 11:32
Goodbye PackageStates.php

Getting PackageStates.php out of your TYPO3 project's git

Why?

Ideally your git repository only contains code that you and your team wrote yourself by hand.

  • 3rd party code should be included via a dependency manager (like composer)
  • Generated files (like compiled stylesheets) should be excluded and be regenerated whenever needed (for example when you deploy your code to a server).

PackageStates.php contains the information which TYPO3 extensions are available and loaded in the system and is typically generated when you use the extension manager to (un)install extensions.

@bwaidelich
bwaidelich / Routes.yaml
Last active August 29, 2015 14:01
Example routing setup for the "Flickr" Plugin of the TYPO3.NeosDemoTypo3Org package
-
name: 'Flickr: User stream'
uriPattern: '{node}/user/{--typo3_neosdemotypo3org-flickr.userId}.html'
defaults:
'@package': 'TYPO3.Neos'
'@controller': 'Frontend\Node'
'@action': 'show'
'@format': 'html'
'--typo3_neosdemotypo3org-flickr':
'@package': 'TYPO3.NeosDemoTypo3Org'
<?php
/* *
* This script belongs to the TYPO3 Flow framework. *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
* The TYPO3 project - inspiring people to share! *
* */
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript">
window.onresize = function(){
var agent = navigator.userAgent;
var current_width = window.innerWidth;
var html = document.getElementsByTagName('html')[0];
if (agent.match(/Android.*Mobile|BlackBerry|iPhone|iPod|Opera Mini|IEMobile/i)) {
@bwaidelich
bwaidelich / User.php
Created August 21, 2013 09:20
Simple example for a custom User domain object with some convenience methods in TYPO3 Flow
<?php
namespace Some\Package\Domain\Model;
use TYPO3\Flow\Annotations as Flow;
use Doctrine\ORM\Mapping as ORM;
use TYPO3\Flow\Security\Policy\Role;
use TYPO3\Party\Domain\Model\AbstractParty;
/**
* A User
#!/usr/bin/php
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL ^ E_STRICT);
define('FLOW_PATH_ROOT', __DIR__ . DIRECTORY_SEPARATOR);
define('FLOW_PATH_PACKAGES', FLOW_PATH_ROOT . 'Packages' . DIRECTORY_SEPARATOR);
class Gerrit {
<?php
use TYPO3\Surf\Domain\Model\Node;
use TYPO3\Surf\Domain\Model\SimpleWorkflow;
$application = new \TYPO3\Surf\Application\TYPO3\Flow();
$application->setOption('version', getenv('VERSION'));
$application->setOption('repositoryUrl', getenv('REPOSITORY'));
$application->setOption('localPackagePath', FLOW_PATH_DATA . 'Checkout' . DIRECTORY_SEPARATOR . $deployment->getName() . DIRECTORY_SEPARATOR . getenv('DEPLOYMENT_NAME') . DIRECTORY_SEPARATOR);
$application->setOption('composerCommandPath', getenv('COMPOSER_PATH') ? getenv('COMPOSER_PATH') : '/usr/bin/composer');
$application->setOption('transferMethod', 'rsync');
@bwaidelich
bwaidelich / CacheViewHelper.php
Created November 29, 2012 12:03
Cache View Helper for TYPO3 Fluid
<?php
namespace Your\Package\ViewHelpers;
/* *
* This script belongs to the TYPO3 Flow package "Your.Package". *
* *
* It is free software; you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License, either version 3 *
* of the License, or (at your option) any later version. *
* *
<?php
namespace ......;
/* *
* This script belongs to the TYPO3 Flow package '........'. *
* *
* */
use TYPO3\Flow\Annotations as Flow;
@bwaidelich
bwaidelich / EntityManagerFactoryAspect.php
Created October 19, 2012 11:13
Doctrine behaviors in TYPO3 Flow - Example: Softdeletable
<?php
namespace YourPackage\Aop;
use TYPO3\Flow\Annotations as Flow;
/**
* @Flow\Aspect
*/
class EntityManagerFactoryAspect {