Skip to content

Instantly share code, notes, and snippets.

View tyrsson's full-sized avatar
:octocat:
Focusing

Joey Smith tyrsson

:octocat:
Focusing
View GitHub Profile
@tyrsson
tyrsson / explore.php
Last active August 31, 2025 17:34
Cedric
<?php
namespace IPS\explorefeeds\modules\front\explore;
if ( !\defined('\\IPS\\SUITE_UNIQUE_KEY') ) { exit; }
class explore extends \IPS\Dispatcher\Controller
{
public static bool $csrfProtected = TRUE;
public function execute(): void
@tyrsson
tyrsson / ajaxhandler.php
Created May 2, 2025 09:36
Non Framework Request handling
<?php
$enableHtmx = true; // Set to false to disable HTMX and ajax requests
function isActionRequest(
array $methods = ['POST'], // the methods to check for
?string $formControl = null, // the form control to check for
): bool {
// if $enableHtmx is false and method is not POST then match will return 'GET'
@tyrsson
tyrsson / NormalizedArgument.php
Last active April 15, 2025 06:36
NormalizedArgument Enum
<?php
declare(strict_types=1);
namespace App\Handler;
use Laminas\Db\Sql\ExpressionInterface;
use Laminas\Db\Sql\SqlInterface;
use InvalidArgumentException;
@tyrsson
tyrsson / postloop.php
Created April 6, 2025 21:46
postloop controller
<?php
class Postloop_ControllerPublic_Postloop extends XenForo_ControllerPublic_Abstract
{
public function actionIndex()
{
$postloopVersion = "2.1";
$software = "XenForo 1.x";
$db = XenForo_Application::get('db');
<?php
declare(strict_types=1);
namespace Authenticatie\Controller;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use Authenticatie\Form\LoginForm;
use Authenticatie\Model\User;
<?php
namespace Authenticatie\Controller\Factory;
use Psr\Container\ContainerInterface;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Laminas\Authentication\Adapter\DbTable\CallbackCheckAdapter;
use Authenticatie\Controller\AuthenticatieController;
use Laminas\Authentication\AuthenticationService;
@tyrsson
tyrsson / CreateTableHandler.php
Created February 26, 2025 22:16
Minimal laminas-db create table example
<?php
declare(strict_types=1);
namespace App\Handler;
use Laminas\Db\Adapter\Adapter;
use Laminas\Db\Metadata\Metadata;
use Laminas\Db\Sql\Ddl;
use Laminas\Db\Sql\Sql;
@tyrsson
tyrsson / tree.json
Created January 29, 2025 04:31
Simple Machines 3.0 Action/Subaction Tree
{
"running": "build-action-tree",
"directories": {
"Admin": {
"ACP": [],
"AntiSpam": [],
"Attachments": {
"attachments": "attachmentSettings",
"avatars": "avatarSettings",
"browse": "browse",
@tyrsson
tyrsson / response.php
Last active January 22, 2025 21:27
Simple Response
<?php
declare(strict_types=1);
interface ContentTypeInterface
{
public final const HEADER_FIELD = 'Content-Type';
public final const TYPE_HTML = 'text/html';
public final const TYPE_JSON = 'application/json';
public final const TYPE_TEXT = 'text/plain';
@tyrsson
tyrsson / injection.php
Created January 4, 2025 18:49
Injection Example
<?php
interface ContractOne
{
public function methodOne();
}
interface ContractTwo
{
public function methodTwo();