Download the PHP package ctfang/laravel-watch without Composer

On this page you can find all versions of the php package ctfang/laravel-watch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-watch

laravel 业务函数委托执行

函数委托执行,特别适用于扩展业务时又不需要侵入原有代码。

安装

composer require ctfang/laravel-watch

如果使用Phpstorm, 可以安装扩展 PHP Annotations 方便提示。

使用

在app目录下任意类的函数注释上加 @Watch(test::class,"func") 就会自动经过 test->func

1。先设计一个场景,一个登陆需求。 原来代码是这样的,只实现了登陆功能,成功返回用户信息。

2。需求有变动,需要加上登陆流水、登陆途径和流失记录(登陆失败也记录)

新增逻辑类 LoginLogic, 实现逻辑

修改 LoginController 文件新增注释代码, 注意注释的类使用也是要use进来的

注意

为了更方便委托,logic类必须需要make方式或者laravel注入方式实例类

例如一个查看用户info的函数需要代理,controller 函数需要这样子写,LoginLogic需要注入或者app('LoginLogic')

    public function info(Request $request, LoginLogic $logic)
    {
        $userId = $request->input('user_id');

        return ['user' => $logic->info($userId)];
    }

info的函数代码


    /**
     * @Watch(LoginLogic::class,"infoWatch")
     */
    public function info(int $id)
    {
        return [];
    }

    public function infoWatch(Context $context, \Closure $next)
    {
        $id = $context->getInput('id');

        echo "玩家被读取" . $id;
    }

All versions of laravel-watch with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3|^8.0
doctrine/annotations Version ^1.12
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ctfang/laravel-watch contains the following files

Loading the files please wait ....