Swoft component

The functions of swoft are provided by different components. For example, http-server provides http server-related functions, and websocket-server provides the functions of websocket server.

In this chapter we mainly introduce how to develop a component.

Writing components

Swoft provides very convenient customization and extension capabilities, you can write components for swowt just like writing a normal composer package. Through the Swoft event you can basically access any stage of the Swoft application to get any information you need.

Code specification

  • Functional description
  • Code style follows PSR-2
  • Follow the PSR-4 autoloading specification
  • Complete unit test

Of course, these are just suggestions and recommendations. Better code structure and style can be easily read by other developers and promote your components.