Zend Framework  2.4
Static Public Member Functions | Public Attributes | Static Protected Member Functions | Static Protected Attributes | List of all members
Version Class Reference

Class to store and retrieve the version of Zend Framework. More...

Static Public Member Functions

static compareVersion ($version)
 Compare the specified Zend Framework version string $version with the current Zend::VERSION of Zend Framework.
 
static getLatest ($service=self::VERSION_SERVICE_ZEND, Http\Client $httpClient=null)
 Fetches the version of the latest stable release.
 
static isLatest ()
 Returns true if the running version of Zend Framework is the latest (or newer??) than the latest tag on GitHub, which is returned by self::getLatest().
 

Public Attributes

const VERSION = '2.4.0'
 Zend Framework version identification - see compareVersion()
 
const VERSION_SERVICE_GITHUB = 'GITHUB'
 Github Service Identifier for version information is retrieved from.
 
const VERSION_SERVICE_ZEND = 'ZEND'
 Zend (framework.zend.com) Service Identifier for version information is retrieved from.
 

Static Protected Member Functions

static getApiResponse (Http\Client $httpClient)
 Get the API response to a call from a configured HTTP client.
 
static getLatestFromGithub (Http\Client $httpClient=null)
 Get the latest version from Github.
 
static getLatestFromZend (Http\Client $httpClient=null)
 Get the latest version from framework.zend.com.
 

Static Protected Attributes

static $latestVersion
 

Detailed Description

Class to store and retrieve the version of Zend Framework.

Member Function Documentation

static compareVersion (   $version)
static

Compare the specified Zend Framework version string $version with the current Zend::VERSION of Zend Framework.

Parameters
string$versionA version string (e.g. "0.7.1").
Returns
int -1 if the $version is older, 0 if they are the same, and +1 if $version is newer.
static getApiResponse ( Http\Client  $httpClient)
staticprotected

Get the API response to a call from a configured HTTP client.

Parameters
Http\Client$httpClientConfigured HTTP client
Returns
string|false API response or false on error
static getLatest (   $service = self::VERSION_SERVICE_ZEND,
Http\Client  $httpClient = null 
)
static

Fetches the version of the latest stable release.

By default, this uses the API provided by framework.zend.com for version retrieval.

If $service is set to VERSION_SERVICE_GITHUB, this will use the GitHub API (v3) and only returns refs that begin with * 'tags/release-'. Because GitHub returns the refs in alphabetical order, we need to reduce the array to a single value, comparing the version numbers with version_compare().

See Also
http://developer.github.com/v3/git/refs/#get-all-references http://framework.zend.com/api/zf-version?v=2 string $service Version service with which to retrieve the version Http $httpClient HTTP client with which to retrieve the version string
static getLatestFromGithub ( Http\Client  $httpClient = null)
staticprotected

Get the latest version from Github.

Parameters
Http\Client$httpClientConfigured HTTP client
Returns
string|null API response or false on error
static getLatestFromZend ( Http\Client  $httpClient = null)
staticprotected

Get the latest version from framework.zend.com.

Parameters
Http\Client$httpClientConfigured HTTP client
Returns
string|null API response or false on error
static isLatest ( )
static

Returns true if the running version of Zend Framework is the latest (or newer??) than the latest tag on GitHub, which is returned by self::getLatest().

Returns
bool

Member Data Documentation

$latestVersion
staticprotected
const VERSION = '2.4.0'

Zend Framework version identification - see compareVersion()

const VERSION_SERVICE_GITHUB = 'GITHUB'

Github Service Identifier for version information is retrieved from.

const VERSION_SERVICE_ZEND = 'ZEND'

Zend (framework.zend.com) Service Identifier for version information is retrieved from.