Skip to content

Instantly share code, notes, and snippets.

View Deele's full-sized avatar

Nils Deele

View GitHub Profile
@Deele
Deele / backend__config__main.php
Last active July 29, 2021 19:28
Yii2 (advanced app) - Creating frontend URLs in backend and vice versa
<?php
$config = [
'components' => [
// [...]
'request' => [
'baseUrl' => $params['backend.baseUrl'],
],
'urlManagerFrontend' => [
'class' => 'yii\web\UrlManager',
'baseUrl' => $params['frontend.baseUrl'],
@Deele
Deele / sse.html
Last active July 1, 2023 04:16
Server-Sent Events example, Javascript client-side, PHP server-side
<html>
<body>
<div id="result"></div>
<script>
if (typeof(EventSource) !== 'undefined') {
console.info('Starting connection...');
var source = new EventSource('/stream.php');
source.addEventListener('open', function(e) {
console.info('Connection was opened.');
}, false);