Download the PHP package safran-cassiopee/php-metar-decoder without Composer

On this page you can find all versions of the php package safran-cassiopee/php-metar-decoder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-metar-decoder

PHP METAR decoder

License Build Status Coverage Status Latest Stable Version

A PHP library to decode METAR strings, fully unit tested (100% code coverage)

You can try it on the demo website.

They use php-metar-decoder in production:

Introduction

This piece of software is a library package that provides a parser to decode raw METAR observation.

METAR is a format made for weather information reporting. METAR weather reports are predominantly used by pilots and by meteorologists, who use it to assist in weather forecasting. Raw METAR format is highly standardized through the International Civil Aviation Organization (ICAO).

Requirements

This library package only requires PHP >= 5.3

It is currently tested automatically for PHP 5.3, 5.4 and 5.5.

If you want to integrate it easily in your project, you should consider installing composer on your system. It is not mandatory though.

Setup

Add the following line to the composer.json of your project

Launch install from your project root with:

Load the library thanks to composer autoloading:

Download the latest release from github

Extract it wherever you want in your project. The library itself is in the src/ directory, the other directories are not mandatory for the library to work.

Load the library with the static import file:

Usage

Instantiate the decoder and launch it on a METAR string. The returned object is a DecodedMetar object from which you can retrieve all the weather properties that have been decoded.

All values who have a unit are based on the Value object which provides the methods getValue() and getUnit()

TODO: full documentation of the structure of the DecodedMetar object

About Value objects

In the example above, it is assumed that all requested parameters are available. In the real world, some fields are not mandatory thus it is important to check that the Value object (containing both the value and its unit) is not null before using it. What you do in case it's null is totally up to you.

Here is an example:

Value objects also contain their unit, that you can access with the getUnit() method. When you call getValue(), you'll get the value in this unit.

If you want to get the value directly in another unit you can call getConvertedValue($unit). Supported values are speed, distance and pressure.

Here are all available units for conversion:

About parsing errors

When an unexpected format is encountered for a part of the METAR, the parsing error is logged into the DecodedMetar object itself.

All parsing errors for one metar can be accessed through the getDecodingExceptions() method.

By default parsing will continue when a bad format is encountered. But the parser also provides a "strict" mode where parsing stops as soon as an error occurs. The mode can be set globally for a MetarDecoder object, or just once as you can see in this example:

About parsing errors, again

In non-strict mode, it is possible to get a parsing error for a given chunk decoder, while still getting the decoded information for this chunk in the end. How is that possible ?

It is because non-strict mode not only continues decoding where there is an error, it also tries the parsing again on the "next chunk" (based on whitespace separator). But all errors on first try will remain logged even if the second try suceeded.

Let's say you have this chunk AAA 12003KPH ... provided to the SurfaceWind chunk decoder. This decoder will choke on AAA, will try to decode 12003KPH and will succeed. The first exception for surface wind decoder will be kept but the SurfaceWind object will be filled with some information.

All of this does not apply to strict mode as parsing is interrupted on first parsing error in this case.

Contribute

If you find a valid METAR that is badly parsed by this library, please open a github issue with all possible details:

If you want to improve or enrich the test suite, fork the repository and submit your changes with a pull request.

If you have any other idea to improve the library, please use github issues or directly pull requests depending on what you're more comfortable with.

In order to contribute to the codebase, you must fork the repository on github, than clone it locally with:

Install all the dependencies using make (composer is needed):

You're ready to launch the test suite with:

This library is fully unit tested, and uses PHPUnit to launch the tests.

Travis CI is used for continuous integration, which triggers tests for PHP 5.3, 5.4, 5.5 for each push to the repo.

If you're interested in code coverage you'll also need xdebug installed and enabled (package php5-xdebug on debian), then you can generate the html report about tests code coverage with:


All versions of php-metar-decoder with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package safran-cassiopee/php-metar-decoder contains the following files

Loading the files please wait ....