简体   繁体   中英

what is the difference between an API and a package?

We need an API for a PHP project but the API(OMDB API) is not for free so we looked for an alternative and saw this package called imdbphp( https://packagist.org/packages/imdbphp/imdbphp ). Is this package enough to be an alternative to the API or they have different functions?

Thank you very much.

The package is a library (Group of classes or files) that can perform something.

In the context you mentioned in the question, an API is a web interface for retrieving data (movies, sports, weather or whatever).

This package in particular (imdbphp) uses an API to get the movies data from the Internet. So it is more like a wrapper above the API.

And I don't really know about how good this package is (What API it uses or it only parses plain imdb.com).

Api (Application Programming Interface).

Is a type of module that is already scripted. You only need to put it in your script file and use it as you want.

Api example -> Let suppose you want to access laptop camera and it requires an api to access camera. You will have to buy api that allow us to access laptop camera.

Package (More than one modules).

Is like a bunch. This bunch contains many modules/apis. So you are allowed to use each module/api in that bunch as you want.

Package example -> Let suppose you want to access laptop camera and it requires an api to access camera. You will have to buy api that allow us to access laptop camera but there is a package that is a bit expensive than api which contains more than one api that allow us to access laptop camera, and also laptop audio.

A package is a bit expensive than an api but package contains more items than a single api.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM