Skip to content

Instantly share code, notes, and snippets.

View voku's full-sized avatar
:octocat:
There is nothing good unless you do it.

Lars Moelleken voku

:octocat:
There is nothing good unless you do it.
View GitHub Profile
@voku
voku / Codelight_Manifesto.md
Last active November 26, 2024 16:28
Codelight Manifesto

Codelight Manifesto

Tip: AI Copilot that follows this document: https://chatgpt.com/g/g-6737e2027dbc8191a00c2a73abf7907e-codelight

Why We Need the Codelight Manifesto

Imagine building a house without standardized measurements for doors or windows. Every house would need custom furniture, and moving between homes would feel like solving a puzzle. Software development in many ways is still in this stage of chaos—a "wild west" era where the lack of universal principles often leads to inefficiencies, miscommunication, and brittle systems.

Take this example:

@voku
voku / clean_code.md
Created September 1, 2023 10:53 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@voku
voku / PHPGPT.md
Last active November 25, 2024 15:21
Coding: Me as PHP chat bot. 🤖

Live-Version:

https://chatgpt.com/g/g-g1905v3LQ-php-copilot

Custom Instruction:

{
 "personality": "This GPT, responds as experienced senior PHP developer and architect Lars Moelleken from github.com/voku and ALWAYS applies a combination of `Sync_Process_Collaborative_Workflow.md` and `Workflow-Framework` as extendable workflow. He writes modern, strict PHP code with specific types and PHPDoc annotations, focusing on readability and precision to support static code analysis and maintainable systems: `CODING_MANIFEST.md`. All code includes specific PHPDoc annotations for e.g. array types, int-ranges, Generics, Generator, and conditional types, or when type hints alone don’t convey full intent; PhpDoc includes e.g. generics (`@template TValue`, `@extends AbstractValueObject`, `@implements Rule`), class-strings (`class-string`), arrays (`list`, `array`, `non-empty-list`), array-shapes (`array{foo?
#!/usr/bin/php
<?php
$output = [];
exec('[ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ] && echo "remote" || echo "local"', $output);
if ($output[0] != 'local') {
echo "Run this script only on your computer!\n\n";
// @codingStandardsIgnoreStart
exit(1);
// @codingS
<?php
use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
final class VdmgReturnIntValueCheckSniff implements Sniff {
/**
* String representation of error.
*
<?php
declare(strict_types=1);
namespace vdmg\App\scripts\githooks\StandardVdmg\PHPStan;
use PhpParser\Node;
use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;
@voku
voku / mod-ide-helper.php
Created February 4, 2020 22:08
generate "PHPSTORM_META" dynamic
#!/usr/bin/php
<?php
namespace my_helper {
// init
$str = '';
require_once __DIR__ . '/boostrap.php';
require_once __DIR__ . '/etc/config.php';
@voku
voku / Makefile
Created December 10, 2018 23:38
A Makefile example from a php project with support for different code quality tools.
# WARNINGS && INFO:
# - a "\t" (tab) is needed before the commands, do not use spaces ..."
# - a "$" has special meaning in Makefiles, you need to double it to pass it)
# - please install/use the "Makefile support"-plugin for PhpStrom :)
TEST_ENV ?= local
CHECK_FILES ?= .
PHPSTAN_LEVEL ?= 3
@voku
voku / code_check_git_hook.php
Created December 10, 2018 23:05
A pre-commit-hook example with Code Sniffer + Code Fixer + PHPStan
#!/usr/bin/php
<?php
/**
* //
* // add something like this in your "composer post-update-cmd && post-install-cmd"
* //
* echo "\n\n";
* echo "Run force \"code_check_git_hook.php\" as pre-commit-hook ...";
* $force_pre_commit_hook_cmd = 'ln -sf YOUR_PATH_TO_CODE_CHECK_SCRIPTS/code_check_git_hook.php YOUR_PATH_TO_PROJECT_ROOT/.git/hooks/pre-commit';
@voku
voku / check_code_phpstan.php
Created December 10, 2018 22:29
A wrapper for phpstan, so you can use PHP7.0 and PHP7.1
#!/usr/bin/php
<?php
use Composer\XdebugHandler\XdebugHandler;
require_once __DIR__ . '/YOUR_PATH_THE_AUTOLOADER.php';
$xdebug = new XdebugHandler('phpstan-code-check');
$xdebug->check();
unset($xdebug);