Skip to content

Instantly share code, notes, and snippets.

View Teisi's full-sized avatar

Christian-Hackl Teisi

View GitHub Profile
@helhum
helhum / PersistentObjectConverter.php
Last active January 24, 2021 14:08
Extbase TypeConverter to fetch hidden records from persistence (Using this will *always* fetch hidden models of the specified type)
<?php
namespace MyVendor\MyExtension\Property\TypeConverters
use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter
class MyPersistentObjectConverter extends PersistentObjectConverter {
/**
* @var string
*/
@stojg
stojg / parse-xml.php
Last active November 18, 2022 21:31
Parsing a huge XML with closure in PHP
<?php
// An example on how to parse massive XML files with PHP by chunking it up to avoid running out of memory
// Open the XML
$handle = fopen('file.xml', 'r');
// Get the nodestring incrementally from the xml file by defining a callback
// In this case using a anon function.
nodeStringFromXMLFile($handle, '<item>', '</item>', function($nodeText){
// Transform the XMLString into an array and