Want to make the API where to start?

I want to make a rest API (php + mysql), experience in creating API at all. Let's have a mobile phone, which will communicate with server via API, and the goal is to make a good rest API.
The questions are the following:
1) whether to make an IPA using some framework or from scratch?
2) it is necessary to allocate a separate server for the API, or just daddy in a project called api, and there all the files associated with to put?
3) good examples, literature, who can advise. When I enter the rest api, php issued a couple of lessons, but it's not quite what I need) need best Praktis different
June 3rd 19 at 20:22
6 answers
June 3rd 19 at 20:24
You should start with designing the API. Take this https://swagger.io/ sketch and everything you need.
Swagger allows you to combine the routing, documentation, and examples of the challenges into a unified whole.
In addition, it allows you to generate stubs for different programming languages and frameworks.
In principle, you can find a significant number of integrations for different frameworkof.

Generally API better to do with frameworks, because they have implemented the trivial moments for security, authentication and authorization. You can use microframework, such as the Slim. You can even generate a routing to it using the generator from Swagger.

In REST there are 6 principles, are well summarized in Wiki. In REST there is nothing complicated and special. It's just a superstructure over the standard HTTP Protocol. That is why there are no special lessons. The work will study the HTTP and you will understand how the web in General and REST in particular.

Regarding a separate server for the API. There are many different approaches. In recent time become more and more important Serverless application. Serverless architecture fits in with the REST. But I think for you it is still too early and complicated. Too much for start.

It is more logical to keep the project in the mono repository if it is not large. If you are not sure how big it will be, it is possible to break the project into components and use Composer for dependency management (recommend fully to read this page from cover to cover).

About best practices there is a very good resource https://12factor.net/ru/
It generally applies for all applications.

Remember: the first pancake is always lumpy. Read all of the resources that I brought for you. They have a lot of links to other, walk around it, look. Write the first version of the API so, as you think convenient. Try to apply the practice of the articles.
You need experience and you don't gain until you do something yourself. You can spend a year at reading, but will remain at the same place from which started. And another person will write on the knee of the API, and then rewrite it 20 times in a year and he will tell you 10 times more than what you have studied during the year.
Go for it!
Swager not beautiful :) - holden.Leuschke commented on June 3rd 19 at 20:27
what then is beautiful? - marietta.Jones commented on June 3rd 19 at 20:30
, https://paw.cloud - holden.Leuschke commented on June 3rd 19 at 20:33
that looks cool, but it's for Mac only? - marietta.Jones commented on June 3rd 19 at 20:36
it's the same postman, only for Mac and for 50 bucks? - Michael.Watsica commented on June 3rd 19 at 20:39
just to sageru need to add https://github.com/Rebilly/ReDoc - Ericka_Rutherfo commented on June 3rd 19 at 20:42
Absolutely crazy and bad advice for the person who makes the API for the first time and has little idea what it is. - Julia_Tremblay33 commented on June 3rd 19 at 20:45
what's the paw? I go nuts with tips))) - Julia_Tremblay33 commented on June 3rd 19 at 20:48
the question arises , what does svagger at all?))) - Julia_Tremblay33 commented on June 3rd 19 at 20:51
you ask where svagger to the rest API? Know, as a beginner give to draw block schemes of algorithms or graph databases, and from the API you can start with its design. - Michael.Watsica commented on June 3rd 19 at 20:54
have a paw in openapi/swagger format - Michael.Watsica commented on June 3rd 19 at 20:57
only all the same, the foot is intended primarily for the test.

she's awesome, but to describe it appy good idea. - kavon.Murphy commented on June 3rd 19 at 21:00
What's the difference how much and what I say, just beautiful. And then someone like that. I'm willing to pay - buy it. You are ready - go to opencores. - holden.Leuschke commented on June 3rd 19 at 21:03
I do not offer it, view thread) - Michael.Watsica commented on June 3rd 19 at 21:06
oops, Akella missed)) - kavon.Murphy commented on June 3rd 19 at 21:09
litter. - kavon.Murphy commented on June 3rd 19 at 21:12
June 3rd 19 at 20:26
But if the project is not on Caravel, and the other frameworks? - holden.Leuschke commented on June 3rd 19 at 20:29
It doesn't matter. - marietta.Jones commented on June 3rd 19 at 20:32
to refer to the model framework Yii2 to take the data, how will I? Isn't the syntax of larval? In the lumen enclosing eloquent - holden.Leuschke commented on June 3rd 19 at 20:35
i.e. the Question of how daravelski framework I will refer to the other models of the framework and whether it is good Praktis? - marietta.Jones commented on June 3rd 19 at 20:38

The question of how daravelski framework I will refer to the other models of the framework and whether it is good Praktis?

How do you imagine that?
What yii can't do the rest api? - Michael.Watsica commented on June 3rd 19 at 20:41
in Yii2 api is out of the box, install nothing, just inherit the controller from ActiveController and all - Ericka_Rutherfo commented on June 3rd 19 at 20:44
June 3rd 19 at 20:28
Judging by Your question, You are still far from creating an API, if the goal is commercial, it is better to turn to professionals.

If for yourself, then of course you need to start to learn a framework, with it, any major will offer is not a bad decision for the API.

"it is necessary to allocate a separate server for the API, or just daddy in a project called api, and there all the files associated with it to believe?"... Honestly, it's still early, pattern the Front Controller in the blood of every web developer.
Complete nonsense. API significantly simpler than the creation of a modern front. - holden.Leuschke commented on June 3rd 19 at 20:31
and what I wrote about the front? - marietta.Jones commented on June 3rd 19 at 20:34
June 3rd 19 at 20:30
No need to reinvent the wheel.
Rock ready cases - best Praktis.

It is necessary to insult each and every novice inventor.
You still early to invent of API - first foreign use and not put out, very clever found here.

The initiative is severely punished.
Should all be standard and model - in this sense of the sacred in the industry.
June 3rd 19 at 20:32
I am a beginner, but did on laravel (for growth). My task was not hard, quickly "moved" into the database. The network is full of turtorials and live on the topic. Install Insomnia or Postman to zaprositi to send and test your api.
June 3rd 19 at 20:34
Like today, all the major frameworks have API interfaces? Or am I missing something? IMHO to get ready a well-oiled engine and it quickly and gently lift IPA - best Praktis.

Find more questions by tags RESTful API