之前開發手寫了curl的方法,支援get和post請求
現在要用 put 和 delete 方法,我想找一個專門負責請求的類別庫,不知有沒有?最好能 composer 安裝,謝謝
ringa_lee
https://packagist.org/package... 這個
guzzle,requests比較常用
A proper REST client for php 一直在用這個,還不錯。
<?php $pest = new Pest('http://example.com'); $thing = $pest->get('/things'); $thing = $pest->post('/things', array( 'name' => "Foo", 'colour' => "Red" ) ); $thing = $pest->put('/things/15', array( 'colour' => "Blue" ) ); $pest->delete('/things/15'); ?>
https://packagist.org/package... 這個
guzzle,requests比較常用
A proper REST client for php 一直在用這個,還不錯。