I'm currently designing a PHP HTTP library and I'm trying to decide between two possible directory structures. Which one would be considered better practice, and why?
Structure A
+ httpLib/
| . Index.php / Factory
| . API.php
| . _Exception.php
| + Response/
| | . Interface.php
| | . ...
| + Request/
| | . Interface.php
| | . ...
Structure B
+ httpLib/
| . Response.php
| . Request.php
| . API.php
| . _Exception.php
| + Client/
| | . Interface.php
| | . Socket.php
| | . Stream.php
| | . cURL.php
...
Structure A organizes files based on type or category (all request-related classes inside Request/, responses inside Response/).
Structure B seems to group core classes at the top level and separates out different client implementations under the Client/ directory.
Thanks in advance!
The first structure is the best.
With it you can better separate the requests and responses.
The structures of the requests and responses are well defined and not in a single class