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

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

matteosister/gitelephant — php скрипт управления git-ом

matteosister/gitelephant - php скрипт управления git-ом

Пример использования

use GitElephant\\Repository;
$repo = new Repository('/path/to/git/repository');

// or the factory method
$repo = Repository::open('/path/to/git/repository');
$repo->getCommit(); // get a Commit instance of the current HEAD
$repo->getCommit('v1.0'); // get a Commit instance for a tag
$repo->getCommit('1ac370d'); // full sha or part of it

// or directly create a commit object
$commit = new Commit($repo, '1ac370d');
$commit = new Commit($repo, '1ac370d'); // head commit

// count commits
$repo->countCommits('1ac370d'); // number of commits to arrive at 1ac370d
// commit is countable, so, with a commit object, you can do
$commit->count();
// as well as
count($commit);

https://github.com/matteosister/gitelephant

mjaschen/phpgeo — простая гео библиотека на PHP

<?php

use Location\\Coordinate;
use Location\\Distance\\Vincenty;

$coordinate1 = new Coordinate(19.820664, -155.468066); // Mauna Kea Summit
$coordinate2 = new Coordinate(20.709722, -156.253333); // Haleakala Summit

echo $coordinate1->getDistance($coordinate2, new Vincenty()); // returns 128130.850 (meters; ?128 kilometers)

https://github.com/mjaschen/phpgeo

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. ...
  9. 40
Scroll Up