PHP Classes
elePHPant
Icontem

NASA Near Earth Orbit API Client: Get near Earth orbit object data with NASA API

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (146)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2016-12-03 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 178 All time: 8,358 This week: 395Up
Version License PHP version Categories
neowsclient 1.0.0MIT/X Consortium ...5.6PHP 5, Web services, Physics
Description Author

This class can get near Earth orbit object data with NASA API.

It can send HTTP requests to NASA Open API to retrieve several types of information about near Earth orbit objects.

Currently it can get information about object orbital data, distances, velocity, diameters, etc..

Innovation Award
PHP Programming Innovation award nominee
December 2016
Number 4


Prize: One subscription to the PDF edition of the PHP Architect magazine
Near Earth objects can be comets or asteroids that came of the outer space and have been attracted to the planet Earth.

NASA keeps track of these objects and makes the known information about them available via an API.

This way you may be informed of known near Earth objects that are coming close to the planet.

This class provides means to extract the known information of near Earth objects using this NASA API.

Manuel Lemos
  Performance   Level  
Name: Sergii Pryz <contact>
Classes: 9 packages by
Country: Ukraine Ukraine
Age: 34
All time rank: 153126 in Ukraine Ukraine
Week rank: 196 Up3 in Ukraine Ukraine Up
Innovation award
Innovation award
Nominee: 4x

Details

NeoWsClient

PHP 7 ready Latest Stable Version License SensioLabsInsight

Master

Build Status Coverage Status

Dev

Build Status Coverage Status

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:

  • feed
  • neo
  • stats

Requirements

Installation

Update to your composer.json with:

{
    "require": {
        "picamator/neo-ws-client": "~1.0"
    }
}

Examples

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:

Arbitrary precision math

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.

Technical specification

That section describes extension and configuration points.

Dependency injection

NeoWsClient uses Symfony DI. It's configuration in services.yml.

Data mapping

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

Errors

There are three different error types:

  • Response HTTP codes: 401, 403, 404
  • Response HTTP code 200 with empty body
  • Exception

Response HTTP codes: 401, 403, 404

In case of getting HTTP codes: 401, 403, 404 or any unsuccessful one application return empty response. Empty response means valid Response object where:

  • code: is a http code
  • data: stdClass over body response string
  • rateLimit: valid rate limit object with data if they are present in API's header

Response HTTP code 200 with empty body

If 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.

Exception

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.

Documentation

Developing

To configure developing environment please:

  1. Follow Docker installation steps
  2. Run inside Docker container composer install

Contribution

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.

License

NeoWsClient is licensed under the MIT License. Please see the LICENSE file for details.

Screenshots  
  • statistics.png
  Files folder image Files  
File Role Description
Files folder imageconfig (2 files)
Files folder imagedev (3 directories)
Files folder imagedoc (2 directories)
Files folder imagesrc (8 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file CHANGELOG.md Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file LICENSE.txt Lic. License
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file parameters.yml.dist Data Auxiliary data
  Accessible without login Plain text file services.yml Data Auxiliary data

  Files folder image Files  /  dev  
File Role Description
Files folder imagedocker (2 files, 1 directory)
Files folder imagephpdoc (3 files)
Files folder imagetests (1 file, 2 directories)

  Files folder image Files  /  dev  /  docker  
File Role Description
Files folder imagephp (1 file, 1 directory)
  Accessible without login Plain text file docker-compose.yml Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  dev  /  docker  /  php  
File Role Description
Files folder imageconfig (2 files)
  Accessible without login Plain text file Dockerfile Data Auxiliary data

  Files folder image Files  /  dev  /  docker  /  php  /  config  
File Role Description
  Accessible without login Plain text file 20-xdebug.ini Data Auxiliary data
  Accessible without login Plain text file php.ini Data Auxiliary data

  Files folder image Files  /  dev  /  phpdoc  
File Role Description
  Accessible without login Plain text file phpdoc.sh Data Auxiliary data
  Accessible without login Plain text file phpdoc.xml Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  dev  /  tests  
File Role Description
Files folder imageintegration (1 directory)
Files folder imageunit (1 directory)
  Accessible without login Plain text file phpunit.xml.dist Data Auxiliary data

  Files folder image Files  /  dev  /  tests  /  integration  
File Role Description
Files folder imagesrc (1 file, 3 directories)

  Files folder image Files  /  dev  /  tests  /  integration  /  src  
File Role Description
Files folder imageExample (7 files)
Files folder imagefixture (9 files)
Files folder imageManager (5 files)
  Plain text file BaseTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  integration  /  src  /  Example  
File Role Description
  Plain text file FeedTest.php Class Class source
  Plain text file FeedTodayTest.php Class Class source
  Plain text file NeoBrowseTest.php Class Class source
  Plain text file NeoTest.php Class Class source
  Plain text file StatisticsTest.php Class Class source
  Plain text file WrongApiKeyTest.php Class Class source
  Plain text file WrongResourceTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  integration  /  src  /  fixture  
File Role Description
  Accessible without login Plain text file feed.detailed.json Data Auxiliary data
  Accessible without login Plain text file feed.json Data Auxiliary data
  Accessible without login Plain text file feed.today.detailed.json Data Auxiliary data
  Accessible without login Plain text file feed.today.json Data Auxiliary data
  Accessible without login Plain text file neo.browse.json Data Auxiliary data
  Accessible without login Plain text file neo.json Data Auxiliary data
  Accessible without login Plain text file stats.json Data Auxiliary data
  Accessible without login Plain text file wrong.api.key.json Data Auxiliary data
  Accessible without login Plain text file wrong.resource.json Data Auxiliary data

  Files folder image Files  /  dev  /  tests  /  integration  /  src  /  Manager  
File Role Description
  Plain text file FeedTest.php Class Class source
  Plain text file FeedTodayTest.php Class Class source
  Plain text file NeoBrowseManagerTest.php Class Class source
  Plain text file NeoManagerTest.php Class Class source
  Plain text file StatisticsManagerTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  
File Role Description
Files folder imagesrc (1 file, 5 directories)

  Files folder image Files  /  dev  /  tests  /  unit  /  src  
File Role Description
Files folder imageHttp (1 file)
Files folder imageManager (1 file, 1 directory)
Files folder imageMapper (1 file, 3 directories)
Files folder imageModel (1 file, 1 directory)
Files folder imageRequest (1 directory)
  Plain text file BaseTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Http  
File Role Description
  Plain text file ClientTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Manager  
File Role Description
Files folder imageBuilder (1 file)
  Plain text file ManagerTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Manager  /  Builder  
File Role Description
  Plain text file RateLimitFactoryTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Mapper  
File Role Description
Files folder imageBuilder (1 file)
Files folder imageFilter (2 files)
Files folder imageRepository (2 files)
  Plain text file MapperTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Mapper  /  Builder  
File Role Description
  Plain text file SchemaCollectionFactoryTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Mapper  /  Filter  
File Role Description
  Plain text file DateTimeFilterTest.php Class Class source
  Plain text file NeoDateFilterTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Mapper  /  Repository  
File Role Description
  Plain text file FeedRepositoryTest.php Class Class source
  Plain text file NeoBrowseRepositoryTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Model  
File Role Description
Files folder imageData (1 file)
  Plain text file ObjectManagerTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Model  /  Data  
File Role Description
  Plain text file PropertySettingTraitTest.php Class Class source

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Request  
File Role Description
Files folder imageBuilder (1 file)

  Files folder image Files  /  dev  /  tests  /  unit  /  src  /  Request  /  Builder  
File Role Description
  Plain text file FeedRequestFactoryTest.php Class Class source

  Files folder image Files  /  doc  
File Role Description
Files folder imageexample (10 files, 1 directory)
Files folder imageuml (2 files)

  Files folder image Files  /  doc  /  example  
File Role Description
Files folder imagetemplate (1 file)
  Accessible without login Plain text file app.php Example Example script
  Accessible without login Plain text file feed.detailed.php Example Example script
  Accessible without login Plain text file feed.php Example Example script
  Accessible without login Plain text file feed.today.detailed.php Example Example script
  Accessible without login Plain text file feed.today.php Example Example script
  Accessible without login Plain text file neo.browse.php Example Example script
  Accessible without login Plain text file neo.php Example Example script
  Accessible without login Plain text file statistics.php Example Example script
  Accessible without login Plain text file wrong.api.key.php Example Example script
  Accessible without login Plain text file wrong.resource.php Example Example script

  Files folder image Files  /  doc  /  example  /  template  
File Role Description
  Accessible without login Plain text file neo.php Example Example script

  Files folder image Files  /  doc  /  uml  
File Role Description
  Accessible without login Image file class.diagram.png Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageApp (1 directory)
Files folder imageException (5 files)
Files folder imageHttp (1 file, 2 directories)
Files folder imageManager (1 file, 2 directories)
Files folder imageMapper (1 file, 5 directories)
Files folder imageModel (1 file, 2 directories)
Files folder imageRequest (3 directories)
Files folder imageResponse (3 directories)

  Files folder image Files  /  src  /  App  
File Role Description
Files folder imageDi (1 directory)

  Files folder image Files  /  src  /  App  /  Di  
File Role Description
Files folder imageHttp (1 file)

  Files folder image Files  /  src  /  App  /  Di  /  Http  
File Role Description
  Plain text file ClientFactory.php Class Class source

  Files folder image Files  /  src  /  Exception  
File Role Description
  Plain text file ExceptionInterface.php Class Class source
  Plain text file HttpClientException.php Class Class source
  Plain text file InvalidArgumentException.php Class Class source
  Plain text file ManagerException.php Class Class source
  Plain text file RuntimeException.php Class Class source

  Files folder image Files  /  src  /  Http  
File Role Description
Files folder imageApi (1 file, 1 directory)
Files folder imageData (1 file)
  Plain text file Client.php Class Class source

  Files folder image Files  /  src  /  Http  /  Api  
File Role Description
Files folder imageData (1 file)
  Plain text file ClientInterface.php Class Class source

  Files folder image Files  /  src  /  Http  /  Api  /  Data  
File Role Description
  Plain text file ConfigInterface.php Class Class source

  Files folder image Files  /  src  /  Http  /  Data  
File Role Description
  Plain text file Config.php Class Class source

  Files folder image Files  /  src  /  Manager  
File Role Description
Files folder imageApi (1 file, 1 directory)
Files folder imageBuilder (1 file)
  Plain text file Manager.php Class Class source

  Files folder image Files  /  src  /  Manager  /  Api  
File Role Description
Files folder imageBuilder (1 file)
  Plain text file ManagerInterface.php Class Class source

  Files folder image Files  /  src  /  Manager  /  Api  /  Builder  
File Role Description
  Plain text file RateLimitFactoryInterface.php Class Class source

  Files folder image Files  /  src  /  Manager  /  Builder  
File Role Description
  Plain text file RateLimitFactory.php Class Class source

  Files folder image Files  /  src  /  Mapper  
File Role Description
Files folder imageApi (3 files, 2 directories)
Files folder imageBuilder (1 file)
Files folder imageData (1 file)
Files folder imageFilter (2 files)
Files folder imageRepository (4 files)
  Plain text file Mapper.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Api  
File Role Description
Files folder imageBuilder (1 file)
Files folder imageData (1 file)
  Plain text file FilterInterface.php Class Class source
  Plain text file MapperInterface.php Class Class source
  Plain text file RepositoryInterface.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Api  /  Builder  
File Role Description
  Plain text file SchemaCollectionFactoryInterface.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Api  /  Data  
File Role Description
  Plain text file SchemaInterface.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Builder  
File Role Description
  Plain text file SchemaCollectionFactory.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Data  
File Role Description
  Plain text file Schema.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Filter  
File Role Description
  Plain text file DateTimeFilter.php Class Class source
  Plain text file NeoDateFilter.php Class Class source

  Files folder image Files  /  src  /  Mapper  /  Repository  
File Role Description
  Plain text file FeedRepository.php Class Class source
  Plain text file NeoBrowseRepository.php Class Class source
  Plain text file NeoRepository.php Class Class source
  Plain text file StatisticsRepository.php Class Class source

  Files folder image Files  /  src  /  Model  
File Role Description
Files folder imageApi (1 file, 1 directory)
Files folder imageData (4 files, 2 directories)
  Plain text file ObjectManager.php Class Class source

  Files folder image Files  /  src  /  Model  /  Api  
File Role Description
Files folder imageData (3 files, 2 directories)
  Plain text file ObjectManagerInterface.php Class Class source

  Files folder image Files  /  src  /  Model  /  Api  /  Data  
File Role Description
Files folder imageComponent (6 files)
Files folder imagePrimitive (8 files)
  Plain text file FeedInterface.php Class Class source
  Plain text file NeoInterface.php Class Class source
  Plain text file StatisticsInterface.php Class Class source

  Files folder image Files  /  src  /  Model  /  Api  /  Data  /  Component  
File Role Description
  Plain text file CloseApproachInterface.php Class Class source
  Plain text file CollectionInterface.php Class Class source
  Plain text file EstimatedDiameterInterface.php Class Class source
  Plain text file FeedInterface.php Class Class source
  Plain text file NeoBrowseInterface.php Class Class source
  Plain text file NeoDateInterface.php Class Class source

  Files folder image Files  /  src  /  Model  /  Api  /  Data  /  Primitive  
File Role Description
  Plain text file DiameterInterface.php Class Class source
  Plain text file DistanceInterface.php Class Class source
  Plain text file LinkInterface.php Class Class source
  Plain text file OrbitInterface.php Class Class source
  Plain text file PageInterface.php Class Class source
  Plain text file PaginatedLinkInterface.php Class Class source
  Plain text file RateLimitInterface.php Class Class source
  Plain text file VelocityInterface.php Class Class source

  Files folder image Files  /  src  /  Model  /  Data  
File Role Description
Files folder imageComponent (5 files)
Files folder imagePrimitive (8 files)
  Plain text file Feed.php Class Class source
  Plain text file Neo.php Class Class source
  Plain text file PropertySettingTrait.php Class Class source
  Plain text file Statistics.php Class Class source

  Files folder image Files  /  src  /  Model  /  Data  /  Component  
File Role Description
  Plain text file CloseApproach.php Class Class source
  Plain text file Collection.php Class Class source
  Plain text file EstimateDiameter.php Class Class source
  Plain text file NeoBrowse.php Class Class source
  Plain text file NeoDate.php Class Class source

  Files folder image Files  /  src  /  Model  /  Data  /  Primitive  
File Role Description
  Plain text file Diameter.php Class Class source
  Plain text file Distance.php Class Class source
  Plain text file Link.php Class Class source
  Plain text file Orbit.php Class Class source
  Plain text file Page.php Class Class source
  Plain text file PaginatedLink.php Class Class source
  Plain text file RateLimit.php Class Class source
  Plain text file Velocity.php Class Class source

  Files folder image Files  /  src  /  Request  
File Role Description
Files folder imageApi (2 directories)
Files folder imageBuilder (1 file)
Files folder imageData (5 files)

  Files folder image Files  /  src  /  Request  /  Api  
File Role Description
Files folder imageBuilder (1 file)
Files folder imageData (6 files)

  Files folder image Files  /  src  /  Request  /  Api  /  Builder  
File Role Description
  Plain text file FeedRequestFactoryInterface.php Class Class source

  Files folder image Files  /  src  /  Request  /  Api  /  Data  
File Role Description
  Plain text file FeedRequestInterface.php Class Class source
  Plain text file FeedTodayRequestInterface.php Class Class source
  Plain text file NeoBrowseRequestInterface.php Class Class source
  Plain text file NeoRequestInterface.php Class Class source
  Plain text file RequestAwareInterface.php Class Class source
  Plain text file StatisticsRequestInterface.php Class Class source

  Files folder image Files  /  src  /  Request  /  Builder  
File Role Description
  Plain text file FeedRequestFactory.php Class Class source

  Files folder image Files  /  src  /  Request  /  Data  
File Role Description
  Plain text file FeedRequest.php Class Class source
  Plain text file FeedTodayRequest.php Class Class source
  Plain text file NeoBrowseRequest.php Class Class source
  Plain text file NeoRequest.php Class Class source
  Plain text file StatisticsRequest.php Class Class source

  Files folder image Files  /  src  /  Response  
File Role Description
Files folder imageApi (2 directories)
Files folder imageBuilder (1 file)
Files folder imageData (1 file)

  Files folder image Files  /  src  /  Response  /  Api  
File Role Description
Files folder imageBuilder (1 file)
Files folder imageData (1 file)

  Files folder image Files  /  src  /  Response  /  Api  /  Builder  
File Role Description
  Plain text file ResponseFactoryInterface.php Class Class source

  Files folder image Files  /  src  /  Response  /  Api  /  Data  
File Role Description
  Plain text file ResponseInterface.php Class Class source

  Files folder image Files  /  src  /  Response  /  Builder  
File Role Description
  Plain text file ResponseFactory.php Class Class source

  Files folder image Files  /  src  /  Response  /  Data  
File Role Description
  Plain text file Response.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 99%
Total:178
This week:0
All time:8,358
This week:395Up