index.rst 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. .. toctree::
  2. :hidden:
  3. index
  4. faq
  5. basics
  6. events/index
  7. repositories
  8. parts/index
  9. collection
  10. permissions
  11. message_builder
  12. components
  13. interactions
  14. =====
  15. Guide
  16. =====
  17. DiscordPHP is a wrapper for the Discord REST, WebSocket and Voice APIs. Built on top of `ReactPHP <https://reactphp.org/>`_ components. This documentation is based off the latest release.
  18. Requirements
  19. ============
  20. - `PHP 7.4 CLI<https://php.net>`_ or higher
  21. + Will not run on a webserver (FPM, CGI), you must run through CLI. A bot is a long-running process.
  22. + x86 (32-bit) PHP requires ext-gmp extension enabled for handling new Permission values.
  23. - ``ext-json`` for JSON parsing.
  24. - ``ext-zlib`` for gateway packet compression.
  25. Recommended Extensions
  26. ----------------------
  27. - One of ``ext-uv``, ``ext-libev`` or ``evt-event`` (in order of preference) for a faster, and more performant event loop.
  28. - ``ext-mbstring`` if you may handle non-english characters.
  29. - ``ext-gmp`` if running 32-bit PHP.
  30. Voice Requirements
  31. ==================
  32. - x86_64 Windows, Linux or Darwin based OS.
  33. + If you are running on Windows, you must be using PHP 8.0.
  34. - ``ext-sodium`` for voice encryption.
  35. - FFmpeg
  36. Development Environment Recommendations
  37. ---------------------------------------
  38. We recommend using an editor with support for the `Language Server Protocol<https://microsoft.github.io/language-server-protocol/>`_.
  39. A list of supported editors can be found `here <https://microsoft.github.io/language-server-protocol/implementors/servers/>`_.
  40. Here are some commonly used editors:
  41. - Visual Studio Code (built-in LSP support)
  42. - Vim/Neovim (with the `coc.nvim <https://github.com/neoclide/coc.nvim>`_ plugin for LSP support)
  43. - PHPStorm (built-in PHP support)
  44. We recommend installing `PHP Intelephense <https://intelephense.com/>`_ alongside your LSP-equipped editor for code completion alongside other helpful features. There is no need to pay for the premium features, the free version will suffice.
  45. Installation
  46. ============
  47. Installation requries `Composer <https://getcomposer.org>`_.
  48. To install the latest release::
  49. $ composer require team-reflex/discord-php
  50. If you would like to run on the latest ``master`` branch::
  51. $ composer require team-reflex/discord-php dev-master
  52. ``master`` can be substituted for any other branch name to install that branch.
  53. Key Tips
  54. ========
  55. As Discord is a real-time application, events come frequently and it is vital that your code does not block the ReactPHP event loop.
  56. Most, if not all, functions return promises, therefore it is vital that you understand the concept of asynchronous programming with promises.
  57. You can learn more about ReactPHP promises `here <https://reactphp.org/promise/>`_.
  58. Help
  59. ====
  60. If you need any help, feel free to join the `PHP Discorders <https://discord.gg/dphp>`_ Discord and someone should be able to give you a hand. We are a small community so please be patient if someone can't help you straight away.
  61. Contributing
  62. ============
  63. All contributions are welcome through pull requests in our GitHub repository. At the moment we would love contributions towards:
  64. - Unit testing
  65. - Documentation