欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

[Linux] 简单安装和使用composer

程序员文章站 2022-03-26 09:08:54
wget https://getcomposer.org/installer //下载一个脚本文件 php installer //php执行下这个php脚本 mv composer.phar /usr/bin/composer //下载的文件转移到执行目录 composer config -g r... ......
wget https://getcomposer.org/installer  //下载一个脚本文件

php installer  //php执行下这个php脚本

mv composer.phar /usr/bin/composer   //下载的文件转移到执行目录

composer config -g repo.packagist composer https://packagist.laravel-china.org //解决下载慢,不要用https://packagist.phpcomposer.com

composer require overtrue/wechat:~4.0 -vvv   //例子

 

<?php
require_once(dirname(__file__)."/vendor/autoload.php");
use easywechat\factory;

$options = [ 
    'app_id'    => 'wx3cf0f39249eb0exxx',
    'secret'    => 'f1c242f4f28f735d4687abb469072xxx',
    'token'     => 'easywechat',
    'log' => [
        'level' => 'debug',
        'file'  => '/tmp/easywechat.log',
    ],  
    // ...
];

$app = factory::officialaccount($options);

$server = $app->server;
$user = $app->user;

$server->push(function($message) use ($user) {
    $fromuser = $user->get($message['fromusername']);

    return "{$fromuser->nickname} 您好!欢迎关注 overtrue!";
});

$server->serve()->send();