Download .zip |
Info | Example | Screenshots | View files (146) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2016-12-03 (9 days ago) | Not yet rated by the users | Total: 5 This week: 5 | All time: 8,673 This week: 190 |
Version | License | PHP version | Categories | |||
neowsclient 1.0 | MIT/X Consortium ... | 5.6 | PHP 5, Web services, Physics |
Description | Author | |
This class can get near Earth orbit object data with NASA API. |
NeoWsClient - client for NASA Open Api "Near Earth Object Web Service" or NeoWs in short. All NeoWs data is from the NASA JPL Asteroid team.
NeoWsClient supports NeoWs v1 with resources:
Update to your composer.json
with:
{
"require": {
"picamator/neo-ws-client": "~1.0"
}
}
To run examples please create parameters.yml
in config
directory using as a template parameters.yml.dist.
The DEMO_KEY
is a valid api token. It has limitation as requests per hour, per day.
More information in NASA official documentation.
Example list:
NeoWsClient formats only Date to DateTime object all others keeps original API's.
NeoWs uses string for long precision float like e.g. .6304873017364636
execution floatval
on them would removes last two digits.
Therefore NeoWsClient does not convert strings to int
or float
. To make any math with string floats
please use BCMath.
BCMath takes care of arbitrary precision mathematics.
That section describes extension and configuration points.
NeoWsClient uses Symfony DI. It's configuration in services.yml.
NeoWsClient works with data mapping to create objects based on Api response.
To make customization or build objects from API response it's need to create mapper repository object.
Mapper repository object is a simple data storage over schema with implementation Mapper\Api\RespositoryInterface
.
The schema contains:
Name | Is required | Description
--- | --- | ---
source | yes | Key in API response
destination | yes | Property inside NeoWsClient value object
destinationContainer | yes | Name of NeoWsClient object where destination
property is located
schema | no | Sub schema
collectionOf | no | Interface name of NeoWsClient objects that will be present inside collection. It's an interface of destinationContainer
in sub-schema
.
filter | no | Name of NeoWsClient filter object, it runs over API's data
There are three different error types:
In case of getting HTTP codes: 401, 403, 404 or any unsuccessful one application return empty response.
Empty response means valid Response
object where:
stdClass
over body response stringIf API returns empty body with HTTP code 200 with several simultaneously requests. The NeoWsClient Manager rise exception ManagerException
in that case.
Because HTTP code 200 means OK, but body is wrong therefore NeoWsClient can not distinguish valid/invalid data by HTTP code.
That exception SHOULD be catch without putting any logic like resend, wait 3 sec. then resend again etc. Instead it's better to have cache over API.
The full exception list that NeoWsClient rises is in Exception folder. If exception rise it means that application can not proceed request, it does not have any business logic in it.
To configure developing environment please:
composer install
If you find this project worth to use please add a star. Follow changes to see all activities. And if you see room for improvement, proposals please feel free to create an issue or send pull request. Here is a great guide to start contributing.
Please note that this project is released with a Contributor Code of Conduct. By participating in this project and its community you agree to abide by those terms.
NeoWsClient is licensed under the MIT License. Please see the LICENSE file for details.
Screenshots | ||
Files |
File | Role | Description | ||
---|---|---|---|---|
config (2 files) | ||||
dev (3 directories) | ||||
doc (2 directories) | ||||
src (8 directories) | ||||
.travis.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
composer.lock | Data | Auxiliary data | ||
LICENSE.txt | Lic. | License | ||
README.md | Doc. | Documentation |
Files | / | config |
File | Role | Description |
---|---|---|
parameters.yml.dist | Data | Auxiliary data |
services.yml | Data | Auxiliary data |
Files | / | dev |
Files | / | dev | / | docker |
File | Role | Description | ||
---|---|---|---|---|
php (1 file, 1 directory) | ||||
docker-compose.yml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | dev | / | docker | / | php | / | config |
File | Role | Description |
---|---|---|
20-xdebug.ini | Data | Auxiliary data |
php.ini | Data | Auxiliary data |
Files | / | dev | / | phpdoc |
File | Role | Description |
---|---|---|
phpdoc.sh | Data | Auxiliary data |
phpdoc.xml | Data | Auxiliary data |
README.md | Doc. | Documentation |
Files | / | dev | / | tests |
File | Role | Description | ||
---|---|---|---|---|
integration (1 directory) | ||||
unit (1 directory) | ||||
phpunit.xml.dist | Data | Auxiliary data |
Files | / | dev | / | tests | / | integration | / | src |
File | Role | Description | ||
---|---|---|---|---|
Example (7 files) | ||||
fixture (9 files) | ||||
Manager (5 files) | ||||
BaseTest.php | Class | Class source |
Files | / | dev | / | tests | / | integration | / | src | / | Example |
File | Role | Description |
---|---|---|
FeedTest.php | Class | Class source |
FeedTodayTest.php | Class | Class source |
NeoBrowseTest.php | Class | Class source |
NeoTest.php | Class | Class source |
StatisticsTest.php | Class | Class source |
WrongApiKeyTest.php | Class | Class source |
WrongResourceTest.php | Class | Class source |
Files | / | dev | / | tests | / | integration | / | src | / | fixture |
File | Role | Description |
---|---|---|
feed.detailed.json | Data | Auxiliary data |
feed.json | Data | Auxiliary data |
feed.today.detailed.json | Data | Auxiliary data |
feed.today.json | Data | Auxiliary data |
neo.browse.json | Data | Auxiliary data |
neo.json | Data | Auxiliary data |
stats.json | Data | Auxiliary data |
wrong.api.key.json | Data | Auxiliary data |
wrong.resource.json | Data | Auxiliary data |
Files | / | dev | / | tests | / | integration | / | src | / | Manager |
File | Role | Description |
---|---|---|
FeedTest.php | Class | Class source |
FeedTodayTest.php | Class | Class source |
NeoBrowseManagerTest.php | Class | Class source |
NeoManagerTest.php | Class | Class source |
StatisticsManagerTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Manager |
File | Role | Description | ||
---|---|---|---|---|
Builder (1 file) | ||||
ManagerTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Manager | / | Builder |
File | Role | Description |
---|---|---|
RateLimitFactoryTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Mapper |
File | Role | Description | ||
---|---|---|---|---|
Builder (1 file) | ||||
Filter (2 files) | ||||
Repository (2 files) | ||||
MapperTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Mapper | / | Builder |
File | Role | Description |
---|---|---|
SchemaCollectionFactoryTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Mapper | / | Filter |
File | Role | Description |
---|---|---|
DateTimeFilterTest.php | Class | Class source |
NeoDateFilterTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Mapper | / | Repository |
File | Role | Description |
---|---|---|
FeedRepositoryTest.php | Class | Class source |
NeoBrowseRepositoryTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Model |
File | Role | Description | ||
---|---|---|---|---|
Data (1 file) | ||||
ObjectManagerTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Model | / | Data |
File | Role | Description |
---|---|---|
PropertySettingTraitTest.php | Class | Class source |
Files | / | dev | / | tests | / | unit | / | src | / | Request | / | Builder |
File | Role | Description |
---|---|---|
FeedRequestFactoryTest.php | Class | Class source |
Files | / | doc | / | example |
File | Role | Description | ||
---|---|---|---|---|
template (1 file) | ||||
app.php | Example | Example script | ||
feed.detailed.php | Example | Example script | ||
feed.php | Example | Example script | ||
feed.today.detailed.php | Example | Example script | ||
feed.today.php | Example | Example script | ||
neo.browse.php | Example | Example script | ||
neo.php | Example | Example script | ||
statistics.php | Example | Example script | ||
wrong.api.key.php | Example | Example script | ||
wrong.resource.php | Example | Example script |
Files | / | doc | / | uml |
File | Role | Description |
---|---|---|
class.diagram.png | Data | Auxiliary data |
README.md | Doc. | Documentation |
Files | / | src |
Files | / | src | / | Exception |
File | Role | Description |
---|---|---|
ExceptionInterface.php | Class | Class source |
HttpClientException.php | Class | Class source |
InvalidArgumentException.php | Class | Class source |
ManagerException.php | Class | Class source |
RuntimeException.php | Class | Class source |
Files | / | src | / | Http |
File | Role | Description | ||
---|---|---|---|---|
Api (1 file, 1 directory) | ||||
Data (1 file) | ||||
Client.php | Class | Class source |
Files | / | src | / | Manager |
File | Role | Description | ||
---|---|---|---|---|
Api (1 file, 1 directory) | ||||
Builder (1 file) | ||||
Manager.php | Class | Class source |
Files | / | src | / | Manager | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Builder (1 file) | ||||
ManagerInterface.php | Class | Class source |
Files | / | src | / | Manager | / | Api | / | Builder |
File | Role | Description |
---|---|---|
RateLimitFactoryInterface.php | Class | Class source |
Files | / | src | / | Mapper |
File | Role | Description | ||
---|---|---|---|---|
Api (3 files, 2 directories) | ||||
Builder (1 file) | ||||
Data (1 file) | ||||
Filter (2 files) | ||||
Repository (4 files) | ||||
Mapper.php | Class | Class source |
Files | / | src | / | Mapper | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Builder (1 file) | ||||
Data (1 file) | ||||
FilterInterface.php | Class | Class source | ||
MapperInterface.php | Class | Class source | ||
RepositoryInterface.php | Class | Class source |
Files | / | src | / | Mapper | / | Api | / | Builder |
File | Role | Description |
---|---|---|
SchemaCollectionFactoryInterface.php | Class | Class source |
Files | / | src | / | Mapper | / | Filter |
File | Role | Description |
---|---|---|
DateTimeFilter.php | Class | Class source |
NeoDateFilter.php | Class | Class source |
Files | / | src | / | Mapper | / | Repository |
File | Role | Description |
---|---|---|
FeedRepository.php | Class | Class source |
NeoBrowseRepository.php | Class | Class source |
NeoRepository.php | Class | Class source |
StatisticsRepository.php | Class | Class source |
Files | / | src | / | Model |
File | Role | Description | ||
---|---|---|---|---|
Api (1 file, 1 directory) | ||||
Data (4 files, 2 directories) | ||||
ObjectManager.php | Class | Class source |
Files | / | src | / | Model | / | Api |
File | Role | Description | ||
---|---|---|---|---|
Data (3 files, 2 directories) | ||||
ObjectManagerInterface.php | Class | Class source |
Files | / | src | / | Model | / | Api | / | Data |
File | Role | Description | ||
---|---|---|---|---|
Component (6 files) | ||||
Primitive (8 files) | ||||
FeedInterface.php | Class | Class source | ||
NeoInterface.php | Class | Class source | ||
StatisticsInterface.php | Class | Class source |
Files | / | src | / | Model | / | Api | / | Data | / | Component |
File | Role | Description |
---|---|---|
CloseApproachInterface.php | Class | Class source |
CollectionInterface.php | Class | Class source |
EstimatedDiameterInterface.php | Class | Class source |
FeedInterface.php | Class | Class source |
NeoBrowseInterface.php | Class | Class source |
NeoDateInterface.php | Class | Class source |
Files | / | src | / | Model | / | Api | / | Data | / | Primitive |
File | Role | Description |
---|---|---|
DiameterInterface.php | Class | Class source |
DistanceInterface.php | Class | Class source |
LinkInterface.php | Class | Class source |
OrbitInterface.php | Class | Class source |
PageInterface.php | Class | Class source |
PaginatedLinkInterface.php | Class | Class source |
RateLimitInterface.php | Class | Class source |
VelocityInterface.php | Class | Class source |
Files | / | src | / | Model | / | Data |
File | Role | Description | ||
---|---|---|---|---|
Component (5 files) | ||||
Primitive (8 files) | ||||
Feed.php | Class | Class source | ||
Neo.php | Class | Class source | ||
PropertySettingTrait.php | Class | Class source | ||
Statistics.php | Class | Class source |
Files | / | src | / | Model | / | Data | / | Component |
File | Role | Description |
---|---|---|
CloseApproach.php | Class | Class source |
Collection.php | Class | Class source |
EstimateDiameter.php | Class | Class source |
NeoBrowse.php | Class | Class source |
NeoDate.php | Class | Class source |
Files | / | src | / | Model | / | Data | / | Primitive |
File | Role | Description |
---|---|---|
Diameter.php | Class | Class source |
Distance.php | Class | Class source |
Link.php | Class | Class source |
Orbit.php | Class | Class source |
Page.php | Class | Class source |
PaginatedLink.php | Class | Class source |
RateLimit.php | Class | Class source |
Velocity.php | Class | Class source |
Files | / | src | / | Request | / | Api | / | Builder |
File | Role | Description |
---|---|---|
FeedRequestFactoryInterface.php | Class | Class source |
Files | / | src | / | Request | / | Api | / | Data |
File | Role | Description |
---|---|---|
FeedRequestInterface.php | Class | Class source |
FeedTodayRequestInterface.php | Class | Class source |
NeoBrowseRequestInterface.php | Class | Class source |
NeoRequestInterface.php | Class | Class source |
RequestAwareInterface.php | Class | Class source |
StatisticsRequestInterface.php | Class | Class source |
Files | / | src | / | Request | / | Data |
File | Role | Description |
---|---|---|
FeedRequest.php | Class | Class source |
FeedTodayRequest.php | Class | Class source |
NeoBrowseRequest.php | Class | Class source |
NeoRequest.php | Class | Class source |
StatisticsRequest.php | Class | Class source |
Files | / | src | / | Response | / | Api | / | Builder |
File | Role | Description |
---|---|---|
ResponseFactoryInterface.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
99% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Related pages |
Near Earth Object Web Service A web service for near earth objects. All the data is from the NASA JPL Asteroid team. |
NASA Open Api The objective of this site is to make NASA data, including imagery, eminently accessible to application developers. |
B612 Foundation The goal of B612 is to protect Earth from asteroid impacts. |