Тестовое задание для ПХП разработчика.
Написать код, который будет симулировать запрос API фейсбука для получения постов пользователя.
Когда кто-то обращается к нам, надо сходить на фейсбук с теми-же параметрами, получить данные в JSON виде, сохранить данные в локальную базу данных и в следующий раз отдавать их из базы, если они там есть.
Кроме того, надо иметь возможность делать CRUD для данных в локальной DB.
Обязательные тулзы для исполнения задания:
Yii 1.x
Active record
composer
Yii механизм миграций DB
К сожалению, я открыл для себя Yii совсем недавно и сразу начал осваивать Yii2. Чтобы не тратить время на переучивание под Yii1, использовал известный мне движок.
The minimum requirement by this project that your Web server supports PHP 5.4.0.
I.e. just clone:
cd /var/www
git clone https://github.com/IuriiP/test160106.git gittest
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
You can then install dependencies using the following command:
composer update
Edit the file config/db.php
with real data, for example:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=<yourDBhost>;dbname=<yourDBname>',
'username' => '<yourDBuserName>',
'password' => '<yourDBpassword>',
'charset' => 'utf8',
];
NOTE: You can leave the default remote database settings.
You can get your application key here or use my test key.
'components' => [
/...
'authClientCollection' => [
/...
'clients' => [
'facebook' => [
/...
'clientId' => '<yourAppId>',
'clientSecret' => '<yourAppSecret>',
/...
],
],
],
/...
],
NOTE: You can leave the default Facebook Application key settings.
php yii migrate/up
Create the virtual host to <yourPathToProject>/web
directory.
mod_rewrite
must be enabled! See about...
Restart Apache.
NOTE: On some hosting provider you'll be directed to root directory only. It's not trouble! The site will work in this case, but you'll have some security vulnerability.
You must login over Facebook account for access to CRUD.