DEV.XFOR.TOP

Email: [email protected] Skype: utz0r2 Github: utz0r2
CSSHTMLPHPJSVideoNoty
E-commerce Scripts: vvStore | vvShop | Avox
© 2008 – 2020

laravel / airlock - легковесная система аутентификации для SPA и простых API

use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;

Route::post('/airlock/token', function (Request $request) {
    $request->validate([
        'email' => 'required|email',
        'password' => 'required',
        'device_name' => 'required'
    ]);

    $user = User::where('email', $request->email)->first();

    if (! $user || ! Hash::check($request->password, $user->password)) {
        throw ValidationException::withMessages([
            'email' => ['The provided credentials are incorrect.'],
        ]);
    }

    return $user->createToken($request->device_name)->plainTextToken;
});

https://github.com/laravel/airlock

krakjoe/ilimit - скрипт для ограничения времени и потребление памяти выполнения в PHP

Требования
PHP 7.1+
NTS
pthread.h

namespace ilimit {
    /**
     * Call a callback while imposing limits on the time and memory that
     * the call may consume.
     *
     * @param callable $callable      The invocation to make.
     * @param array    $arguments     The list of arguments.
     * @param int      $timeout       The maximum execution time, in microseconds.
     * @param int      $maxMemory     The maximum amount of memory, in bytes.
     *                                If set to zero, no limit is imposed.
     * @param int      $checkInterval The interval between memory checks,
     *                                in microseconds. If set to zero or less,
     *                                a default interval of 100 microseconds is used.
     *
     * @return mixed Returns the return value of the callback.
     *
     * @throws Error\Runtime If timeout is not positive.
     * @throws Error\Runtime If maxMemory is negative.
     * @throws Error\System  If the system lacks necessary resources to make the call.
     * @throws Error\Timeout If the invocation exceeds the allowed time.
     * @throws Error\Memory  If the invocation exceeds the allowed memory.
     */
    function call(callable $callable, array $arguments, int $timeout, int $maxMemory = 0, int $checkInterval = 0);
}

https://github.com/krakjoe/ilimit

thomasjohnkane/snooze - пакет для упрощения автоматизации будущих уведомлений и напоминаний в Laravel

use Thomasjohnkane\Snooze\Traits\SnoozeNotifiable;

class User extends Model {
    use SnoozeNotifiable;

    // ...
}

// Schedule a birthday notification
$user->notifyAt(new BirthdayNotification, Carbon::parse($user->birthday));

// Schedule for a week from now
$user->notifyAt(new NextWeekNotification, Carbon::now()->addDays(7));

// Schedule for new years eve
$user->notifyAt(new NewYearNotification, Carbon::parse('last day of this year'));

https://github.com/thomasjohnkane/snooze

seregazhuk/php-watcher - скрипт отслеживает изменения в php-приложении и автоматически перезапускайте его (подходит для асинхронных приложений)

seregazhuk/php-watcher - скрипт отслеживает изменения в php-приложении и автоматически перезапускайте его (подходит для асинхронных приложений)

https://github.com/seregazhuk/php-watcher

PhpWebcam - php библиотека для снятия изображений из вебкамеры

$webcam = new \VDX\Webcam\Webcam();

// It can produce an other size if your webcam does not support the provided size
$webcam->setDesiredSize(1280, 720);

if ($webcam->open()) {
    $webcam->saveFrame('/tmp/test.jpg'/*, true*/); // It accepts a second parameter to mirror the image
    $webcam->close();
}

https://github.com/vdechenaux/PhpWebcam

danog/MadelineProto - асинхронный PHP клиент/сервер API для телеграм MTProto протокол

<?php

if (!file_exists('madeline.php')) {
    copy('https://phar.madelineproto.xyz/madeline.php', 'madeline.php');
}
include 'madeline.php';

$MadelineProto = new \danog\MadelineProto\API('session.madeline');
$MadelineProto->async(true);
$MadelineProto->loop(function () use ($MadelineProto) {
    yield $MadelineProto->start();

    $me = yield $MadelineProto->getSelf();

    $MadelineProto->logger($me);

    if (!$me['bot']) {
        yield $MadelineProto->messages->sendMessage(['peer' => '@danogentili', 'message' => "Hi!\nThanks for creating MadelineProto! <3"]);
        yield $MadelineProto->channels->joinChannel(['channel' => '@MadelineProto']);

        try {
            yield $MadelineProto->messages->importChatInvite(['hash' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg']);
        } catch (\danog\MadelineProto\RPCErrorException $e) {
            $MadelineProto->logger($e);
        }

        yield $MadelineProto->messages->sendMessage(['peer' => 'https://t.me/joinchat/Bgrajz6K-aJKu0IpGsLpBg', 'message' => 'Testing MadelineProto!']);
    }
    yield $MadelineProto->echo('OK, done!');
});

https://github.com/danog/MadelineProto
Вверх