PHP Interface Development Considerations
-
Pre-defined interface processes and logic to confirm requirements
Identify processes before development, complex interfaces can draw flowcharts, and ensure processes are consistent with requirements;
-
Use a uniform variable definition
Both the SDK and server are dependent on the definition of the same variable and the settings of the global variable. The purpose is to facilitate maintenance
-
Perfect exception handling mechanism
Interface is to provide services to the outside, once the abnormal impact of large, and even affect the security of the system. Therefore, a set of perfect exception handling mechanisms is needed. For functions such as file_get_contents and fsocket, such as a common network connection timeout, you need to use @ To suppress the error output
-
Unified Message Output format
The output of the unified format will be largely user-friendly
-
Compatibility of the SDK
Fully consider the compatibility of the SDK, not all users of the environment are 5.3, not all environments support curl. The worst consideration is prompting the user to install the Curl extension. The PHP version limit can be at least 5.0, do not use their unfamiliar functions, especially the PHP version is dependent on the
-
Friendly Error Hints
Error alerts should be optimized for user data, regardless of whether the service is working properly
-
Security mechanisms
Strict filtering of user input data to avoid the security problems of service
-
Service High Availability
Many businesses rely on service interfaces, so high availability of interfaces is essential, and monitoring interfaces should be established to detect and eliminate the interfaces on which the services depend.
From for notes (Wiz)
PHP Interface Development Considerations