/php-identifiers

Collection of utilities related to the extraction, validation and normalization of various scholarly identifiers.

Primary LanguagePHPMIT LicenseMIT

Identifiers Build Status

Collection of utilities related to the extraction, validation and normalization of various scholarly identifiers.

Current version: 0.10.1
Supported PHP versions: 5.4, 5.5, 5.6, 7

Installation

$ composer require altmetric/identifiers

Supported identifiers

The supported list is:

API Documentation

public AdsBibcode::extract(string $str): array

use Altmetric\Identifiers\AdsBibcode;

$bibcodes = AdsBibcode::extract('ADS: 1974AJ.....79..819H');
//=> ['1974AJ.....79..819H']

Return an array of ADS bibcodes from a given string. Will return an empty array if no matches are found.

public ArxivId::extract(string $str): array

use Altmetric\Identifiers\ArxivId;

$arxivIds = ArxivId::extract("math.GT/0309136\narXiv:1501.00001v2");
//=> ['math.GT/0309136', '1501.00001v2']

Return an array of arXiv IDs from a given string. Will return an empty array if no matches are found.

public Doi::extract(string $str): array

use Altmetric\Identifiers\Doi;

$dois = Doi::extract('doi:10.1049/el.2013.3006')
//=> ['10.1049/el.2013.3006']

Return an array of DOIs (including ISBN-As) from a given string. Will return an empty array if no matches are found.

public Handle::extract(string $str): array

use Altmetric\Identifiers\Handle;

$handles = Handle::extract('http://hdl.handle.net/10149/596901')
//=> ['10149/596901']

Return an array of Handles from a given string. Will return an empty array if no matches are found.

public Isbn::extract(string $str): array

use Altmetric\Identifiers\Isbn;

$isbns = Isbn::extract("ISBN: 9780805069099\nISBN: 2-7594-0269-X");
//=> ['9780805069099', '9782759402694']

Return an array of ISBN-13s from a given string. Will convert ISBN-As and ISBN-10s to ISBN-13s automatically and return an empty array if no matches are found.

public NationalClinicalTrialId::extract(string $str): array

use Altmetric\Identifiers\NationalClinicalTrialId;

$nctIds = NationalClinicalTrialId::extract('Trial ID: NCT00000106');
//=> ['NCT00000106']

Return an array of National Clinical Trial IDs from a given string. Will return an empty array if no matches are found.

public OrcidId::extract(string $str): array

use Altmetric\Identifiers\OrcidId;

$orcidIds = OrcidId::extract('orcid.org/0000-0002-0088-0058');
//=> ['0000-0002-0088-0058']

Return an array of ORCID identifiers from a given string. Will return an empty array if no matches are found.

public PubmedId::extract(string $str): array

use Altmetric\Identifiers\PubmedId;

$pubmedIds = PubmedId::extract("23193287\n14599470\nhttps://www.ncbi.nlm.nih.gov/pubmed/123\npmid:456\ninfo:pmid/789");
//=> ['23193287', '14599470', '123', '456', '789']

Return an array of PubMed IDs from a given string. Will return an empty array if no matches are found.

public RepecId::extract(string $str): array

use Altmetric\Identifiers\RepecId;

$repecIds = RepecId::extract("RePEc:wbk:wbpubs:2266\nRePEc:inn:wpaper:2016-03");
//=> ['RePEc:wbk:wbpubs:2266', 'RePEc:inn:wpaper:2016-03']

Return an array of RePEc identifiers from a given string. Will return an empty array if no matches are found.

public Urn::extract(string $str): array

use Altmetric\Identifiers\Urn;

$urns = Urn::extract("urn:foo:bar\nURN:FOO:BA%2CZ");
//=> ['urn:foo:bar', 'urn:foo:BA%2cZ']

Return an array of URNs from a given string. Will return an empty array if no matches are found.

public Uri::extract(string $str): array

use Altmetric\Identifiers\Uri;

$uris = Uri::extract("http://www.altmetric.com:80/foo?bar#1");
//=> ['http://www.altmetric.com:80/foo?bar#1']

Return an array of URIs from a given string. Will return an empty array if no matches are found.

Ruby version

We also maintain a version of this library for Ruby.

Acknowledgements

License

Copyright © 2016-2017 Altmetric LLP

Distributed under the MIT License.