use GuzzleHttp\Client;
use Offdev\Csv\Stream;
use Offdev\Csv\Parser;
$client = new Client();
$response = $client->get('http://httpbin.org/get');
$stream = Stream::factory($response->getBody());
$parser = new Parser($stream);
do {
$record = $parser->readLine();
echo $record ? $record->get('header-column2').PHP_EOL : '';
} while (!$parser->eof());
https://github.com/offdev/csv
https://github.com/localheinz/composer-normalize
https://github.com/ricardofiorani/php-legofy
$source = 'en';
$target = 'ru';
$attempts = 5;
$arr = array('hello','world');
$tr = new GoogleTranslateForFree();
$result = $tr->translate($source, $target, $arr, $attempts);
var_dump($result);
/*
array(2) {
[0]=>
string(24) "Здравствуйте"
[1]=>
string(6) "Мир"
}
*/
https://github.com/dejurin/php-google-translate-for-free
https://github.com/imanghafoori1/laravel-heyman
The PDO Way
$db = new \PDO(
'mysql:host=localhost;dbname=something',
'username',
'putastrongpasswordhere'
);
$statement = $db->prepare('SELECT * FROM comments WHERE blogpostid = ? ORDER BY created ASC');
$exec = $statement->execute([$_GET['blogpostid']]);
$rows = $statement->fetchAll(\PDO::FETCH_ASSOC);
foreach ($rows as $row) {
$template_engine->render('comment', $row);
}
The EasyDB Solution
$db = \ParagonIE\EasyDB\Factory::create(
'mysql:host=localhost;dbname=something',
'username',
'putastrongpasswordhere'
);
$rows = $db->run('SELECT * FROM comments WHERE blogpostid = ? ORDER BY created ASC', $_GET['blogpostid']);
foreach ($rows as $row) {
$template_engine->render('comment', $row);
}
https://github.com/paragonie/easydb