Skip to content

Instantly share code, notes, and snippets.

View diloabininyeri's full-sized avatar

Dılo abinin yeri diloabininyeri

View GitHub Profile
@diloabininyeri
diloabininyeri / chain_condition_bank.php
Last active February 15, 2023 14:05
the pick one a bank in the too complex conditions
<?php
class User
{
}
interface BankWithdraw
{
public function withdraw(User $user): array;
@diloabininyeri
diloabininyeri / bank.php
Last active February 14, 2023 08:24
Here is the scenario, let's think that there are different banks, and in a mechanism that will receive requests and process the response, how can we make a structure for all the responses?
<?php
/**
*
*/
interface BankTransaction
{
public function getTurkishId(): int;
@diloabininyeri
diloabininyeri / mix.php
Last active December 27, 2022 12:40
create laravel mix architecture with php core
<?php
/**
* @author Dılo sürücü
*/
interface CompileInterface
{
public function then(Closure $closure);
public function compile();
@diloabininyeri
diloabininyeri / cli
Created November 27, 2022 21:19
xdebug run from terminal
export XDEBUG_MODE=debug XDEBUG_SESSION=1
@diloabininyeri
diloabininyeri / test.php
Last active November 5, 2022 23:01
The example of send cargo with strategy dessign pattern in php
<?
interface ShippingDetailInterface
{
public function getNumber(): int;
public function getName(): string;
}
interface ShippingInterface
@diloabininyeri
diloabininyeri / test.php
Last active January 10, 2025 23:29
Converting an object to JSON with PHP using Attribute,
<?php
require_once 'vendor/autoload.php';
#[Attribute(Attribute::TARGET_METHOD)]
class Json
{
}
@diloabininyeri
diloabininyeri / test.php
Created October 28, 2022 10:09
php call dynamic method event that doesnt exist in object ...
<?php
/**
*
*/
#[Attribute(Attribute::TARGET_PROPERTY)]
class Name
{
@diloabininyeri
diloabininyeri / index.php
Created October 17, 2022 21:56
PHP observer design pattern example
<?php
/**
*
*/
interface HandleInterface
{
/**
* @param Content $content
@diloabininyeri
diloabininyeri / memoize.php
Created October 15, 2022 21:57
php memoize example with class
<?php
class Memoize
{
private static array $cache = [];
public static function once(string $functionName): Closure
{
@diloabininyeri
diloabininyeri / filter.php
Created October 2, 2022 21:14
php filter desing pattern
<?php
$persons = [
[
'name' => 'ali',
'gender' => 'man',
'age' => 18
],
[