Skip to content

Instantly share code, notes, and snippets.

@demisang
demisang / ApiRateLimiter.php
Last active Sep 30, 2020
Yii2 Api RateLimiter class with Redis storage implementation
View ApiRateLimiter.php
<?php
namespace common\components\rateLimiter;
use Yii;
use yii\base\BaseObject;
use yii\filters\RateLimitInterface;
/**
* API rate limiter.
@demisang
demisang / AesCipher.java
Last active Apr 6, 2021
AES/CBC/PKCS5Padding encrypt/decrypt PHP and JAVA example classes
View AesCipher.java
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;
View common config main.php
<?php
return [
'aliases' => [
'@bower' => '@vendor/bower-asset',
'@npm' => '@vendor/npm-asset',
],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
View AuthRateLimiter.php
<?php
namespace common\components\rateLimiter;
use Yii;
use yii\base\BaseObject;
use yii\filters\RateLimitInterface;
/**
* Auth rate limiter