ahmard/simple-promise 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ahmard/simple-promise

Composer 安装命令:

composer require ahmard/simple-promise

包简介

A simple PHP promise library that works synchronously.

README 文档

README

A simple PHP promise library that works synchronously.

Note

Please note that this library cannot be used in Asynchronous projects, projects like ReactPHP or Amphp.

Installation

Make sure that you have composer installed Composer.

If you don't have Composer run the below command

curl -sS https://getcomposer.org/installer | php

Run the installation

composer require ahmard/simple-promise ^1.0

Usage

<?php
use SimplePromise\Deferred;

require 'vendor/autoload.php';

function test($number)
{
    $deferred = new Deferred();
    
    if ($number > 2){
        $deferred->resolve('Succeeded');
    }else{
        $deferred->reject('Failed');
    }
    
    return $deferred->promise();
}

test(1)->then(function ($data){
    echo $data;
})->otherwise(function ($error){
    echo $error;
});

Examples

统计信息

  • 总下载量: 27
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-07-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固