Skip to content

Commit

Permalink
More documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsizemore committed Dec 25, 2023
1 parent fb811fd commit d0c6aa9
Show file tree
Hide file tree
Showing 9 changed files with 1,183 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ atlassian-ide-plugin.xml
.idea/php.xml
.idea/librariesio.iml
clover.xml
test.php
256 changes: 256 additions & 0 deletions docs/basic-usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,256 @@
# Basic usage

LibrariesIO is a simple API wrapper/client for the Libraries.io API. Since this class solely relies on the libraries.io API, you will need an api key from the libraries.io API service. Signing up for an account is free. You can find your api key in your [account](https://libraries.io/account).

```php
// All at once
use Esi\LibrariesIO\LibrariesIO;
```

Then just use whichever endpoint you need.

Endpoints:

* [Platform](platform.md)
* [Project](project.md)
* [Repository](repository.md)
* [User](user.md)

## Platform Example

The Esi\LibrariesIO\LibrariesIO::platform() function, for example, provides the ability to access the 'platform' API endpoint to gather all platforms the libraries.io service supports.

See more: [Platform](platform.md)

```php
use Esi\LibrariesIO\LibrariesIO;

$api = new LibrariesIO('..yourapikey..', \sys_get_temp_dir());
$response = $api->platform();

print_r($api->raw($response));
```

Would return something like:

```json
[
{
"name": "NPM",
"project_count": 4081204,
"homepage": "https://www.npmjs.com",
"color": "#f1e05a",
"default_language": "JavaScript"
},
{
"name": "Maven",
"project_count": 588275,
"homepage": "http://maven.org",
"color": "#b07219",
"default_language": "Java"
},
{
"name": "Pypi",
"project_count": 499320,
"homepage": "https://pypi.org/",
"color": "#3572A5",
"default_language": "Python"
},
{
"name": "NuGet",
"project_count": 487449,
"homepage": "https://www.nuget.org",
"color": "#178600",
"default_language": "C#"
},
{
"name": "Go",
"project_count": 484898,
"homepage": "https://pkg.go.dev",
"color": "#375eab",
"default_language": null
},
{
"name": "Packagist",
"project_count": 405922,
"homepage": "https://packagist.org",
"color": "#4F5D95",
"default_language": "PHP"
},
{
"name": "Rubygems",
"project_count": 183149,
"homepage": "https://rubygems.org",
"color": "#701516",
"default_language": "Ruby"
},
{
"name": "Cargo",
"project_count": 135799,
"homepage": "https://crates.io",
"color": "#dea584",
"default_language": "Rust"
},
{
"name": "CocoaPods",
"project_count": 96000,
"homepage": "http://cocoapods.org/",
"color": "#438eff",
"default_language": "Objective-C"
},
{
"name": "Bower",
"project_count": 69215,
"homepage": "http://bower.io",
"color": "#563d7c",
"default_language": "CSS"
},
{
"name": "Pub",
"project_count": 48925,
"homepage": "https://pub.dartlang.org",
"color": "#00B4AB",
"default_language": "Dart"
},
{
"name": "CPAN",
"project_count": 40509,
"homepage": "https://metacpan.org",
"color": "#0298c3",
"default_language": "Perl"
},
{
"name": "CRAN",
"project_count": 25484,
"homepage": "https://cran.r-project.org/",
"color": "#198CE7",
"default_language": "R"
},
{
"name": "Clojars",
"project_count": 24189,
"homepage": "https://clojars.org",
"color": "#db5855",
"default_language": "Clojure"
},
{
"name": "Conda",
"project_count": 18850,
"homepage": "https://anaconda.org",
"color": "#fff",
"default_language": null
},
{
"name": "Hackage",
"project_count": 17609,
"homepage": "http://hackage.haskell.org",
"color": "#29b544",
"default_language": null
},
{
"name": "Hex",
"project_count": 15420,
"homepage": "https://hex.pm",
"color": "#6e4a7e",
"default_language": "Elixir"
},
{
"name": "Meteor",
"project_count": 13342,
"homepage": "https://atmospherejs.com",
"color": "#f1e05a",
"default_language": "JavaScript"
},
{
"name": "Homebrew",
"project_count": 8714,
"homepage": "http://brew.sh/",
"color": "#555555",
"default_language": "C"
},
{
"name": "Puppet",
"project_count": 6920,
"homepage": "https://forge.puppet.com",
"color": "#302B6D",
"default_language": "Puppet"
},
{
"name": "Carthage",
"project_count": 4679,
"homepage": "https://github.com/Carthage/Carthage",
"color": "#ffac45",
"default_language": "Swift"
},
{
"name": "SwiftPM",
"project_count": 4207,
"homepage": "https://developer.apple.com/swift/",
"color": "#ffac45",
"default_language": "Swift"
},
{
"name": "Julia",
"project_count": 3042,
"homepage": "http://pkg.julialang.org/",
"color": "#a270ba",
"default_language": "Julia"
},
{
"name": "Elm",
"project_count": 2892,
"homepage": "http://package.elm-lang.org/",
"color": "#60B5CC",
"default_language": "Elm"
},
{
"name": "Dub",
"project_count": 2705,
"homepage": "http://code.dlang.org",
"color": "#ba595e",
"default_language": "D"
},
{
"name": "Racket",
"project_count": 2554,
"homepage": "http://pkgs.racket-lang.org/",
"color": "#375eab",
"default_language": null
},
{
"name": "Nimble",
"project_count": 2354,
"homepage": "https://github.com/nim-lang/nimble",
"color": "#37775b",
"default_language": "Nim"
},
{
"name": "Haxelib",
"project_count": 1703,
"homepage": "https://lib.haxe.org",
"color": "#df7900",
"default_language": "Haxe"
},
{
"name": "PureScript",
"project_count": 747,
"homepage": "https://github.com/purescript/psc-package",
"color": "#1D222D",
"default_language": "PureScript"
},
{
"name": "Alcatraz",
"project_count": 462,
"homepage": "http://alcatraz.io",
"color": "#438eff",
"default_language": "Objective-C"
},
{
"name": "Inqlude",
"project_count": 228,
"homepage": "https://inqlude.org/",
"color": "#f34b7d",
"default_language": "C++"
}
]
```
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require 'vendor/autoload.php';
?>
```

For more information see the [installation](../docs/installation.md) docs.
For more information see the [installation](installation.md) docs.

## Basic Usage

Expand Down Expand Up @@ -104,7 +104,7 @@ Array
?>
```

For more information see the [basic usage](../docs/basic-usage.md) docs.
For more information see the [basic usage](basic-usage.md) docs.

## Testing

Expand All @@ -114,7 +114,7 @@ No actual calls are made to the libraries.io API while performing tests. Instead

## Documentation

The [docs](../docs/) folder or online [here](https://www.secondversion.com/docs/librariesio/).
The `docs/` folder or online [here](https://www.secondversion.com/docs/librariesio/).

## About

Expand Down
25 changes: 25 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Installation

Installing Esi\LibrariesIO is very easy, if you're using [composer](http://getcomposer.com).
If you haven't done so, install composer, and use **composer require** to install Esi\LibrariesIO.

```bash
curl -sS https://getcomposer.org/installer | php
php composer.phar require esi/librariesio
```

## First usage

Make sure you include `vendor/autoload.php` in your application. To make all of LibrariesIO's components available at once:

```php
use Esi\LibrariesIO\LibrariesIO;
```

For more information check out the [basic-usage](basic-usage.md) documenation. Further reading:

* Endpoints:
* [Platform](platform.md)
* [Project](project.md)
* [Repository](repository.md)
* [User](user.md)
Loading

0 comments on commit d0c6aa9

Please sign in to comment.