# 一定要用良好的第三方类库 封装封装,都说封装,既然目的明确的,功能相同的代码,很容易封装成通用的函数或类,所以很多东西早早有大神实现好了,实现得还非常好,开箱即用。 举个例子,在很多时候,我都能在群上看到有人问关于php的curl的问题,都知道curl是 用来发网络请求的。网络请求这个东西在哪门语言都有非常好的实现,我们要做的不是用原始的curl去拼接请求参数,我们应该到github上搜索,百度上搜索,`php网络请求库`这样打关键字都百度搜。然后看看这个实现好不好用,适不适合用,合适就用,到`composer.json`里去声明依赖。 php网络请求推荐使用以下类库,git星星很多,文档完善(英文),文档虽然是英文的,但很容易看懂。 注意:底层还是要依赖curl [php网络请求库](http://docs.guzzlephp.org/en/latest/) ## 第三方类库推荐 * [php网络请求库](http://docs.guzzlephp.org/en/latest/) * [php图片处理](https://github.com/Intervention/image) * [php关于输入验证](https://github.com/Respect/Validation) * [php单元测试](https://github.com/sebastianbergmann/phpunit) * [php日期时间处理](https://github.com/briannesbitt/Carbon) * [php处理markdown](https://github.com/michelf/php-markdown) * [根据注释生成漂亮的api文档](https://github.com/phpDocumentor/phpDocumentor2) * [邮件发送](https://github.com/swiftmailer/swiftmailer) * [PHPOffice](https://github.com/PHPOffice) * [依赖注入容器](https://github.com/PHP-DI/PHP-DI)