Skip to content

Instantly share code, notes, and snippets.

@demisang
demisang / ApiRateLimiter.php
Last active August 10, 2022 15:44
Yii2 Api RateLimiter class with Redis storage implementation
<?php
namespace common\components\rateLimiter;
use Yii;
use yii\base\BaseObject;
use yii\filters\RateLimitInterface;
/**
* API rate limiter.
@demisang
demisang / AesCipher.java
Last active December 16, 2022 02:16
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
import android.support.annotation.Nullable;
import android.util.Base64;
import java.nio.ByteBuffer;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
<?php
return [
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
<?php
namespace common\components\rateLimiter;
use Yii;
use yii\base\BaseObject;
use yii\filters\RateLimitInterface;
/**
* Auth rate limiter