Skip to content

Instantly share code, notes, and snippets.

@Raistlfiren
Raistlfiren / Dockerfile
Last active August 14, 2023 19:02
XDebug 3 and Docker Reference
FROM php:7.4-cli-alpine
# Install xdebug
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .phpize-deps
WORKDIR /var/www/html
@Raistlfiren
Raistlfiren / AbstractHandler.php
Created April 19, 2020 14:56
Symfony 5 Factory/Abstract Class Current Code
<?php
namespace App\Library\Handler;
use App\Library\Test\Client;
use App\Library\Parser\Parser;
abstract class AbstractHandler
{
/**
pages:
name: Pages
singular_name: Page
fields:
title:
type: text
class: large
group: content
slug:
type: slug
<section id="Services" class="light-wrapper">
<div class="container inner">
{% setcontent categories = 'productcategories' orderby 'id' %}
{% for columns in categories|batch(3) %}
<div class="row" style="margin-bottom:20px;">
{% for category in columns %}
<div class="col-md-4">
<div class="Headline-Text">
<h4>{{ category.title }}</h4>
<?php
namespace Bolt\Extension\Test\ExtensionA\Storage\Repository;
class ContentRepository extends \Bolt\Storage\Repository\ContentRepository
{
public function getPublishedContent()
{
taxonomylink:
path: '/{taxonomytype}/{slug}'
defaults:
_controller: 'Bolt\Controllers\Frontend::taxonomy'
requirements:
taxonomytype: 'Bolt\Controllers\Routing::getAnyTaxonomyTypeRequirement'
@Raistlfiren
Raistlfiren / Pagination.php
Created June 8, 2016 13:53
Pagination with New Storage Engine
<?php
namespace Bolt\Extension\Bolt\JsonApi\Storage\Query\Handler;
use Bolt\Extension\Bolt\JsonApi\Storage\Query\PagingResultSet;
use Bolt\Storage\Query\ContentQueryParser;
class PagingHandler
{
<?php
//Create news article routes
$this->get('/create', function(ServerRequestInterface $request, ResponseInterface $response, $args) {
$data = $this->newsHandler->getCreate();
return $this->view->render($response, 'news/show.html.twig', $data);
})->setName('new_create')->add($this->getContainer()->get('csrf'));
$this->post('/create', function(ServerRequestInterface $request, ResponseInterface $response, $args) {
$data = $this->newsHandler->postCreate($request, $response, $this->router);
return $this->view->render($response, 'news/show.html.twig', $data);
<?php
use NewsHandler;
$this->get('/{id:[0-9]+}/edit', function(ServerRequestInterface $request, ResponseInterface $response, $args) {
//Typehint newsHandler automatically instead of doing ->
/** @var NewsHandler $news*/
// $news = $this->newsHandler;
$data = $this->newsHandler->getShow($args['id']);
return $this->view->render($response, 'news/show.html.twig', $data);
<?php
public function initialize()
{
if (empty($this->config['encryption'])) {
$this->config['encryption'] = "plaintext";
}
$this->addTwigFunction('passwordprotect', 'passwordProtect');