Web + Mobile Blog / Berlin http://sebastianviereck.de/en/ PHP Freelancer Mon, 11 Feb 2019 09:44:31 +0000 en hourly 1 http://wordpress.org/?v=3.5.1 Working Gau Frette with file streams http://sebastianviereck.de/en/Gau-Frette-with-file-streams-work/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/Gau-Frette-with-file-streams-work/#comments Mon, 28 Jan 2019 08:34:27 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3906-en Continue reading ]]> To with Gau Frette (Symfony extension) to be able to perform also stream operations on files, can you get the little scrawny documented Stream wrapper verwenden.

This is configured in the gaufrette.yaml:

    stream_wrapper: ~
            adapter: backup

And can then be z.B. the following mass is a csv. Write file:

$stream = fopen('gaufrette://backup1/datei.csv', 'w+');

fputcsv($stream, [1,2,3]);
http://sebastianviereck.de/en/Gau-Frette-with-file-streams-work/feed/ 0
AWS: need to verify an email address in SES without access to the mailbox http://sebastianviereck.de/en/AWS-to-verify-an-email-address-ses-without-access-to-the-mailbox/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/AWS-to-verify-an-email-address-ses-without-access-to-the-mailbox/#comments Fri, 18 Jan 2019 11:57:36 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3901-en Continue reading ]]> To send Amazon SES email, need to verify only the email address. This is a problem, If one has access to the domain, aber keinen Mail-Server eingerichtet hat.

To work around the problem, one only verifies the domain in SES and is then under Configure email receiving a to verifierende E-Mail address and connects them with a SNS topic. After that you can Subscription einrichten auf das SNS Topic via Email und sich so die Verifikations-Email weiterleiten lassen auf ein vorhandenes Postfach.

http://sebastianviereck.de/en/AWS-to-verify-an-email-address-ses-without-access-to-the-mailbox/feed/ 0
Dynamically configure symfony service ID using parameters http://sebastianviereck.de/en/ID-dynamically-configure-symfony-service-using-parameters/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/ID-dynamically-configure-symfony-service-using-parameters/#comments Tue, 20 Nov 2018 09:12:17 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3892-en Continue reading ]]> If you like in his Depnedency configuration of injection (services.yml) the service injections make dynamically configurable wants about the parameters.yml,

    my_class: 'App\MyClass'

can you do this using the Symfony expression language component do:

composer require symfony/expression-language

Then you can define in the services.yml:

        - '@=service(parameter("my_class"))'
http://sebastianviereck.de/en/ID-dynamically-configure-symfony-service-using-parameters/feed/ 0
Windows composer update fatal error: Allowed memory size of 1610612736 bytes exhausted http://sebastianviereck.de/en/Windows-composer-update-fatal-error-allowed-memory-size-of-1610612736-bytes-exhausted/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/Windows-composer-update-fatal-error-allowed-memory-size-of-1610612736-bytes-exhausted/#comments Tue, 13 Nov 2018 13:30:27 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3885-en Continue reading ]]> My composer despite unlimited storage has the following error message:

 composer update
 Loading composer repositories with package information
 Updating dependencies (including require-dev)

 VirtualAlloc() failed: [0x00000008] Zur Verarbeitung dieses Befehls sind nicht gen
 VirtualAlloc() failed: [0x00000008] Zur Verarbeitung dieses Befehls sind nicht gen

 Fatal error: Out of memory (allocated 1260388352) (tried to allocate 201326600 bytes) in phar://C:/ProgramData/ComposerSetup/bin/composer.phar/src/Composer/DependencyResolver/RuleSet.php on line 83

If you can no longer perform a composer update under Windows, Although it has the memory limit to unlimited, then you have a problem:

The Windows Xammp is only as 32 bit system available and RAM can provide only 2 GB at the moment, eine weitere Erhöhung ist nicht möglich.

The solution is to run composer with a 64-bit PHP on the console (This then has up to 4 GB memory).

  • Download PHP x 64 version
  • unzip it and creating a php.ini (the umbennnen php.ini-development)
  • increase memory limit in php.ini: memory_limit = -1
  • run on the console:
"C:\php-7.2.12-nts-Win32-VC15-x64\php" C:\ProgramData\ComposerSetup\bin\composer.phaC update
http://sebastianviereck.de/en/Windows-composer-update-fatal-error-allowed-memory-size-of-1610612736-bytes-exhausted/feed/ 0
Yii2 versus symfony 4 – a framework comparison http://sebastianviereck.de/en/symfony-yii2-4-a-framework-comparison/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/symfony-yii2-4-a-framework-comparison/#comments Sun, 21 Oct 2018 14:17:20 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3873-en Continue reading ]]> Ich habe lange mit Yii und dem Symfony Framework gearbeitet und will versuchen im Folgenden die Unterschiede von beiden Frameworks aus Programmierer Sicht zu erläutern.

Configuration of environments

When you create Web applications is typically at least 2 Environments: The development environment, on which you want to see errors and the live environment, where this should happen. Dazu kommen Test-Umgebung zum Ausführen automatisierter Tests und vielleicht eine Staging Umgebung.

Symfony raises the very skillfully, mit .env Dateien und eigenen Ordnern innerhalb des Konfigurations-Ordners.

At Yii must the programmers themselves lend a hand, to load the correct configuration, There are only from home 3 (dev, Prod, test) Vorgsehen environments, danach wird es unübersichtlich.

Console of commands

Console of commands and normal controller differ in Symfony complete in terms of syntax, jedoch bieten beide dieselbe Funktionalität an.

Here has Yii the advantage of, sich sehr änhlich zu verhalten und denselben Syntax für Controller zu verwenden.

Database interaction

Yii 2 relies on an own database wrapper, with the database operations and migrations are made. Databases need to about Migrations be created and it can then the entities are generated objects. Yii relies on the ActiveRecord pattern, What is unfortunately not ideal from a performance perspective in the sleep to the repository pattern of symfony, Since each entities object dragging unnecessary functionality around with you. On the other hand, everything is centrally stored in a file, be it labels or error messages for forms, Validators for individual attributes or queries on the table. The way each entity is comfortable to use a different database connection. Die Daten können mit Hilfe der Gridview sehr einfach angezeigt werden.

Symfony uses doctrine as ORM Mapper and thus has the advantage, that tables are automatically generated based on the entities definitions, and you can use a much larger range of functions, as well as more auto completition in the IDE will receive as a result of the object-oriented style of doctrine. There is no direct component to display the data in a ListView, Here you can create administration surfaces on the Sonata project back attack, mit dem erstklassige Backends erstellt werden können.

Code generators

Yii has a very good code generator called GII, mit dem neben den Standard Funktionen wie Model und Extensions Skeletons auch CRUD Oberflächen und Formulare sehr schön und schnell generiert werden können auf der Konsole und zusätzlich auch mit einem Web Frontend.

Symfony has recently Symfony maker bundle, which can be very well adapted, aber nicht an die Funktionalität von Gii heran reicht.


Yii has no templating engine home, everything is permitted and is done in the view, It's full of PHP, eigentlich ein Anti Pattern.

Symfony hat eine eigene, very nice templating engine: Twig, mit der man sehr schön View und Applikations-Logik/Code trennen kann.


Yii take an ausgewöhlich simple and extensive REST Implemnetierung with it, mit der man sehr einfach REST Schnittstellen erstellen kann inklusive HATEOAS.

Symfony hat sSymfony has its ownps://symfony.com/doc/master/bundles/FOSRestBundle/index.html">FOSRest Extension, that is but not as elegant as that of Yii. HATEOAS ist nicht verfügbar.


Beide Frameworks habe eigene Debugging Toolbars und Profiling Möglichkeiten an Board.


Yii has a lot of static method calls, die erstmal schwierig zu testen sind.

Symfony benutzt Dependency Injection für alle Services und lässt sich ausgezeichnet testen.

Long Term Support

Yii does not set up with the support, where to symfony LongLong term support>Offer versions, It guarantees 4 Jahre supportet werden.


Yii offers home all caching features, that you may wish:

  • different cache providers: File, REDIS, Database, Memcache, Windcache etc.
  • Database query caching
  • View fragment cYiie
  • HTTP cache

all very axis to use, ein klarer Pluspunkt für Yii.

Symfony can this be just as, only with some extra installation effort, because it is not from home doing. Symfony supports but to the ESI (Edge side includes).

Yii is very easy to set up, very much arrays with beannten keys, die man kennen muss und die einem das Leben schwer machen.

Symfony has dependency injection, What is very comfortable for the testing and work and very understandable, gut lesbaren und testbaren Code produziert.


Symfony is a professional basis for large projects to be tested. Yii ist sehr gut geeignet für schnell zu erstellende Prototypen und kleinere Projekte.

http://sebastianviereck.de/en/symfony-yii2-4-a-framework-comparison/feed/ 0
PHP encode string for extended ASCII 8 bit 255 Sign http://sebastianviereck.de/en/php-udp-encode-string-zu-extended-ascii-8bit-255-zeichen/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/php-udp-encode-string-zu-extended-ascii-8bit-255-zeichen/#comments Thu, 11 Oct 2018 08:00:19 +0000 Sebastian Viereck http://sebastianviereck.de/?p=3868-en Continue reading ]]> To represent also umlauts in a bit, can you get the extended ASCII character set use with 255 Sign, It contains also umlauts like ä, ö, ü und ß.

In order to use this, can I use the following function:

 * @param string $string
 * @return string
protected function asciiEncodeString(string $string): string
    $sourceEncoding = mb_detect_encoding($string);
    $destinationEncoding = 'CP437'; // Extended ASCII - Codepage 437
    $string = iconv($sourceEncoding, $destinationEncoding, $string);
    return $string;
http://sebastianviereck.de/en/php-udp-encode-string-zu-extended-ascii-8bit-255-zeichen/feed/ 0
Adobe Creative Suite CS2 free download and serial number http://sebastianviereck.de/en/Adobe-creative-suite-cs2-free-download-and-serial-number/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/Adobe-creative-suite-cs2-free-download-and-serial-number/#comments Thu, 06 Sep 2018 08:56:40 +0000 Sebastian Viereck http://www.sebastianviereck.de/?p=3853-en Continue reading ]]> Adobe hat netter Weise die CS2 Versionen seiner Creative Suite online gestelllt.

However, it is not simply because to come. Under Windows 10 hatte ich keine Probleme mit den Programmen bis jetzt.

Download of the installer

The files can be here be downloaded, the Keys stehen jeweils neben dem Downloader.

http://sebastianviereck.de/en/Adobe-creative-suite-cs2-free-download-and-serial-number/feed/ 0
Tutorial: Windows data recovery with freeware software http://sebastianviereck.de/en/tutorial-windows-data-recovery-with-freeware-software/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/tutorial-windows-data-recovery-with-freeware-software/#comments Sun, 02 Sep 2018 08:20:50 +0000 Sebastian Viereck http://www.sebastianviereck.de/?p=3842-en Continue reading ]]> When formatted on Windows or recover deleted data want is the freeware version of EaseUS data recovery Wizard free use (also for MAC). So you can recover up to 2 GB of data, with the Pro version unlimited data. But the folder names are lost when a formatting generally permanently, aber die Daten bleiben erhalten.

After downloading and starting the program, must choose the appropriate drive:


Then the drive will be scanned and it deleted and formatted files are ordered listed by file type:



Also you can very easily filter Office documents by type (Excel, Word, Powerpoint) and author of the document and recovers the appropriate data:


Conclusion: EaseUS is a good program, If a good Data recovery freeware, If you want to restore a few files quickly and easily. Es stellt eine sehr gute Filter Funktion für Offcie Dokumente bereit.

http://sebastianviereck.de/en/tutorial-windows-data-recovery-with-freeware-software/feed/ 0
UDP with PHP send and receive sample messages http://sebastianviereck.de/en/send-UDP-with-php-news-and-receive-sample/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/send-UDP-with-php-news-and-receive-sample/#comments Fri, 24 Aug 2018 08:39:40 +0000 Sebastian Viereck http://www.sebastianviereck.de/?p=3832-en Continue reading ]]> With PHP you can send very simple packets over UDP on your own computer. To test this, do you need a transmitter and a receiver. Communicate both via the local IP on port in the Biepsiel 20010. Die Beispiele müssen auf der Konsole ausgeführt werden.


$address = '';
$port = 20010;
$beat_period = 1;

$fp = stream_socket_client("udp://$address:$port", $errno, $errstr);
if (!$fp) {
 the("ERROR: $errno - $errstr");

while (true) {
 $message = sprintf(
 '%s send: %s'. PHP_EOL,
 rand(0, 1000000)
 fwrite($FP, $message);
 echo $message;




$address = '';
$port = 20010;

$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
socket_bind($socket, $address, $port);

ifif$socket === false) {
 throw new \RuntimeException(
 'could not connect to socket address %s on port %s. Error: %s %s',

 echo socket_read ($socket, 1024);
http://sebastianviereck.de/en/send-UDP-with-php-news-and-receive-sample/feed/ 0
Read more UDP frames with PHP parallel with socket_select() http://sebastianviereck.de/en/Read-more-udp-frames-with-php-parallel-with-socket_select/?utm_source=rss&utm_medium=rss& http://sebastianviereck.de/en/Read-more-udp-frames-with-php-parallel-with-socket_select/#comments Tue, 21 Aug 2018 10:44:36 +0000 Sebastian Viereck http://www.sebastianviereck.de/?p=3823-en Continue reading ]]> You can perform operations very difficult parallel in PHP, read but for which there are multiple sockets socket_select() Function. Damit lassen sich mehrere Socket Verbindungen parallel auslesen.

The example 2 UDP socket connections created and at the same time read:

function createSocket(string $ip, int $port)
    $socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
    //set non blocking read
    socket_set_option($socket, SOL_SOCKET, SO_REUSEADDR, 1);
    socket_bind($socket, $ip, $port);

    if ($socket === false) {
        throw new \RuntimeException(
                'could not connect to socket address %s on port %s. Error: %s %s',
    return $socket;
function readSockets()
 $waitTimeoutSeconds = 1;

 $socket1 = $this->createSocket('', 20001);
 $socket2 = $this->createSocket('', 20002);

 $sockets['socket1'] = $socket1;
 $sockets['socket2'] = $socket2;

 $read = $sockets;
 $write = null;
 $except = null;

 if (socket_select($socket_select, $except, $waitTimeoutSeconds))
 // loop through the sockets that showed activity
 if (isset($read['socket1'])) {
    // socket 1 got a message
    $content1 = socket_read ($socket1, 1024);
 if (isset($read['socket2'])) {
    // socket 2 got a message
    $content2 = socket_read ($socket2, 1024);

 } else {
 throw new \RuntimeException('could not read any socket');

http://sebastianviereck.de/en/Read-more-udp-frames-with-php-parallel-with-socket_select/feed/ 0