Stupid async implementation using await-generator

Overview

libAsync

Stupid async implementation using await-generator

Usage

libAsync::doAsync(Closure $executor); // <-- Returns a promise

Example

  • Fetch data from the internet
use SOFe/AwaitGenerator/Await;
use Mcbeany/libAsync/libAsync;
use pocketmine/utils/Internet;

Await::f2c(function(){
    $response = yield from libAsync::doAsync(fn() => Internet::getUrl("example.com"));
    var_dump($response);
});
  • Save file asynchronously
Await::g2c(
    libAsync::doAsync(fn() => file_put_contents('file.txt', 'Hello World!')),
    fn() => $this->getLogger()->info("Saved file successfully!")
);

Note

Do not pass any variables that cannot be serialized to AsyncTask

You might also like...
Algerian code generator for invoices, quotes or any commercial documents

Algerian invoice code generator The library is useful to generate code for invoices, quotes or any commercial transaction document. Goal Is to provide

Magento 2 Code Generator

Magento 2 Code Generator Created by Orba Inspired by https://github.com/staempfli/magento2-code-generator Purpose In day-to-day Magento 2 development

64 bit ID Generator

Particle Language: PHP 64bits int Time Based ID Generator Uncoordinated For high availability within and across data centers, machines generating ids

PHP Sitemap Generator

This class can be used to generate sitemaps and notify updates to search engines.

A simple e-Certificate generator.

SeaJell A simple e-Certificate Generator. Guides You can read all the guides in using the system from the documentation. License Copyright (c) Muhamma

Wordpress Plugin Boilerplate but Powered with examples and a generator!
Wordpress Plugin Boilerplate but Powered with examples and a generator!

WordPress Plugin Boilerplate Powered WordPress Plugin Boilerplate Powered is a complete foundation for building your WordPress plugins following PSR-4

Rah sitemap - XML sitemap generator for Textpattern CMS

rah_sitemap Packagist | Issues | Donate Sitemap plugin for Textpattern CMS. Generates Sitemaps.org XML sitemaps for your site, which help Google and o

Invoice PDF Generator For Magento 2
Invoice PDF Generator For Magento 2

Magento Invoice PDF Generator Magento 2 Invoice PDF Generator - helps you to customize the pdf templates for Magento 2. If you have an enabled templat

Code generator for Magento 2
Code generator for Magento 2

Magento 2 Code Generator Tool Installation Option1: Downloading .phar wget https://github.com/staempfli/magento2-code-generator/releases/download/ver

Releases(v0.0.1)
Owner
Minecraft/PocketMine-MP related stuff
null
Venture allows you to create and manage complex, async workflows in your Laravel apps.

Venture is a package to help you build and manage complex workflows of interdependent jobs using Laravel's queueing system. Installation Note: Venture

Kai Sassnowski 680 Dec 14, 2022
Use php-fpm as a simple built-in async queue

PHP-FPM Async Queue Use php-fpm as a simple built-in async queue. Based on interoperable queue interfaces Queue Interop. Usage composer makasim/php-fp

Max Kotliar 111 Nov 19, 2022
An async process dispatcher for Amp.

process This package provides an asynchronous process dispatcher that works on all major platforms (including Windows). As Windows pipes are file hand

AMPHP 204 Jan 8, 2023
This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized objects in DynamoDB 🚀.

DynamoDB Storable This component, based on the Symfony serializer and async-aws, is a human-readable and quick abstraction to easily store serialized

Matthieu W. 2 Jun 19, 2022
Simple async lowlevel ICMP (ping) messaging library built on top of React PHP

clue/icmp-react Simple async lowlevel ICMP (ping) messaging library built on top of react Usage Once clue/icmp-react is installed, you can run any of

Christian Lück 13 Jun 10, 2022
This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

This repository demonstrates exemplary implementation of chat using HTTP and Websocket servers in PHP using Kraken Framework components.

Kraken 48 Aug 11, 2021
Implementation of an API application using the Phalcon Framework

phalcon-api Sample API using Phalcon Implementation of an API application using the Phalcon Framework https://phalcon.io Installation Clone the projec

The Phalcon PHP Framework 81 Dec 15, 2022
This composer plugin is a temporary implementation of using symbolic links to local packages as dependencies to allow a parallel work process

Composer symlinker A Composer plugin to install packages as local symbolic links. This plugin is a temporary implementation of using symbolic links to

Pierre Cassat 18 Nov 9, 2021
GPT-3 powered business idea generator

The idea (lol) is to give you inspiration to make something cool, if you lack inspiration right now. Many ideas might not be perfect but they might give you the spark to start thinking to get to a really good idea further on.

levelsio 17 Feb 9, 2022
Contracts for Rule Doc Generator. Useful for production code with minimum dependencies.

Rule Doc Generator Contracts Contracts for Rule Doc Generator. Useful for production code with minimum dependencies. Install composer require symplify

null 19 Dec 22, 2022