-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api #705
base: master
Are you sure you want to change the base?
Api #705
Conversation
die(); | ||
} | ||
|
||
function requireFields($data, $fields) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
код стайл: названия функций -- в_такой_нотации
фигурная скобка должна быть на той же строчке
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
if ($reg_status == 1) { | ||
return 'User created'; | ||
} | ||
throw new \Exception("User don't create: invalid data. Status:$reg_status", 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration failed due to invalid data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix
@@ -8,6 +8,13 @@ | |||
return; | |||
} | |||
|
|||
// crutch for api |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А можно пояснить, зачем это на index.php?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
можно. Хочется соответствовать стандартам написания апи и завязать его на url вида /v1.0 (а не /api.php или /?page=api). Например, на facebook так. В идеале, конечно, хотелось бы чтобы у всего сайта была единая точка входа вместо кучи скриптов, best practices типа =)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А, например, на Википедии так: https://ru.wikipedia.org/api/rest_v1 :)
Смержил в текущем виде в веточку и выкатил в тестинг. opencorpora.org:8080, база там продакшен |
Если вы работаете с Symfony, основной язык проекта PHP и вам нужен REST API то рекомендую глянуть насколько вам подойдет API Platform: https://api-platform.com/ Демо можно посмотреть тут: https://demo.api-platform.com Все возможности их API описаны здесь: https://api-platform.com/docs/core#features В основе проекта 4 версия symfony. |
add json rpc api for mobile clients