简体   繁体   English

有没有办法安装没有作曲家的棘轮?

[英]Is there a way install Ratchet without composer?

I have an app that is poorly written is php "spaghetti code" 我有一个写得不好的应用程序是PHP“意大利面条代码”

I need to implement a web-socket where I can use PHP to make calls to an API. 我需要实现一个web-socket,我可以使用PHP来调用API。

I tried to use Node.js but the problem is that there is many things that I need to check for using php. 我试图使用Node.js,但问题是我需要检查使用php的很多东西。

  1. "User must be logged in" I need to check for an active session in my app. “用户必须登录”我需要在我的应用中检查活动会话。 Aka "authenticate the user." Aka“验证用户身份。”
  2. Read the API credentials from the user database from my app after the user have been authenticated. 在用户通过身份验证后,从我的应用程序中读取用户数据库中的API凭据。
  3. Finally, generate a client script that will ping an API every 1 second to check for new messages. 最后,生成一个客户端脚本,每隔1秒ping一次API以检查新消息。

I thought it will be easier if I have a PHP websocket setup instead of node.js where step 1 and 2 already handled by my APP and all I will is just to write a client code that will communicate with the websocket to retrieve the new messages. 我认为如果我有一个PHP websocket设置而不是node.js会更容易,其中第一步和第二步已经由我的APP处理了,我只想编写一个客户端代码,它将与websocket通信以检索新消息。

It sound like Ratchet is a good way to go but not sure how to install it in my APP using the composer if my APP does not have a setup to use composer or autoloaders. 听起来像Ratchet是一个很好的方法,但不知道如果我的APP没有使用作曲家或自动加载器的设置,如何使用作曲家在我的APP中安装它。

While I am working on a project to convert my app to Laravel 5.1, I am in an immediate need to implement the websocket to reduce the amount of the TCP connections that are sent to to my server. 当我正在开发一个将我的应用程序转换为Laravel 5.1的项目时,我迫切需要实现websocket以减少发送到我的服务器的TCP连接数量。

How can I install Ratchet? 我该如何安装棘轮? is there alternative package I can use rather than using Ratchet if I Can't install it in my current environment? 是否有我可以使用的替代包而不是使用Ratchet,如果我不能在我当前的环境中安装它?

install composer on you machine. 在你的机器上安装composer Make sure you install it globally by adding it to your environment path so you can use it from any where in your console. 确保通过将其添加到环境路径全局安装它,以便可以从控制台中的任何位置使用它。

Then from the command line go to the root of your app. 然后从命令行转到应用程序的根目录。 "assuming you do not have a folder called "vendor" in your root" “假设您的根目录中没有名为”vendor“的文件夹”

cd c:/www/app
composer require cboden/ratchet
composer install

You should now be able to use Ratchet as you just installed Ratchet and its dependencies. 您现在应该可以使用Ratchet,因为您刚刚安装了Ratchet及其依赖项。

Good luck! 祝好运!

Lol, user asks what a word means. 大声笑,用户询问一个词是什么意思。 Community responds by using that word in the definition.... 社区通过在定义中使用该词来回应....

I think the OP was looking for an alternative autoloader, or perhaps help with loading the files manually. 我认为OP正在寻找替代自动加载器,或者可能有助于手动加载文件。

您可以检查这一点以安装没有作曲家的Ratchet。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM