Skip to content

Instantly share code, notes, and snippets.

@Raistlfiren
Raistlfiren / Dockerfile
Last active Jul 15, 2021
XDebug 3 and Docker Reference
View Dockerfile
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 Apr 19, 2020
Symfony 5 Factory/Abstract Class Current Code
View AbstractHandler.php
<?php
namespace App\Library\Handler;
use App\Library\Test\Client;
use App\Library\Parser\Parser;
abstract class AbstractHandler
{
/**
View contenttypes.yml
pages:
name: Pages
singular_name: Page
fields:
title:
type: text
class: large
group: content
slug:
type: slug
View Categories and Products.twig
<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>
View ContentRepositoryForExtenstionA.php
<?php
namespace Bolt\Extension\Test\ExtensionA\Storage\Repository;
class ContentRepository extends \Bolt\Storage\Repository\ContentRepository
{
public function getPublishedContent()
{
View routing.yml
taxonomylink:
path: '/{taxonomytype}/{slug}'
defaults:
_controller: 'Bolt\Controllers\Frontend::taxonomy'
requirements:
taxonomytype: 'Bolt\Controllers\Routing::getAnyTaxonomyTypeRequirement'
@Raistlfiren
Raistlfiren / Pagination.php
Created Jun 8, 2016
Pagination with New Storage Engine
View Pagination.php
<?php
namespace Bolt\Extension\Bolt\JsonApi\Storage\Query\Handler;
use Bolt\Extension\Bolt\JsonApi\Storage\Query\PagingResultSet;
use Bolt\Storage\Query\ContentQueryParser;
class PagingHandler
{
View news.php
<?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);
View news.php
<?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);
View protectedpassword.php
<?php
public function initialize()
{
if (empty($this->config['encryption'])) {
$this->config['encryption'] = "plaintext";
}
$this->addTwigFunction('passwordprotect', 'passwordProtect');