Downloads
Stars
Version
Awema packages documentation reader
Via Composer
$ composer require awema-pl/module-docs
The package will automatically register itself.
You can publish the views with:
php artisan vendor:publish --provider="AwemaPL\Docs\DocsServiceProvider" --tag="views"
You can publish the config file with:
php artisan vendor:publish --provider="AwemaPL\Docs\DocsServiceProvider" --tag="config"
Add to routes\web.php
Docs::routes();
use Docs;
Docs::all($withDocs = true);
Docs::get(['package1' => ['1.0', '2.6'], 'package2' => '1.3', 'package3'], 'package4', $withDocs = true);
Docs::package('package1', $withDocs = true);
Docs::versions('package1', $withDocs = true);
Docs::version('package1', '1.0', $withDocs = true);
Docs::files('package1', '1.0', $withDocs = true);
Docs::file('package1', '1.0', 'file.md');
Docs::fileContent('package1', '1.0', 'file.md');
Docs::list();
Docs::list('package1');
Docs::list('package1', '1.0');
Docs::list('package1', '1.0', 'file.md');
Docs::all($withDocs = true);
Output:
[
[
"name" => "package1",
"versions" => [
[
"name" => "1.0",
"files" => [
[
"name" => "index.md",
"content" => "# Title"
],
[
"name" => "doc1.md",
"content" => "Doc 1 content"
]
]
],
...
[
"name" => "2.6",
"files" => [ ... ]
]
]
],
...
[
"name" => "package4",
"versions" => [ ... ]
]
]
Input param $withDocs
is bollean, optional and is true by default.
if $withDocs == false
file content will be null
Docs::get(['package1' => ['1.0', '2.6'], 'package2' => '1.3', 'package3'], 'package4', $withDocs = true);
Last bool param $withDocs
is optional and is true by default
Method output is the same as for all(), but will contain only specified in args packages and versions.
If packages are not listed result will contain all packages.
If versions for specified package is not listed result will contain all versions for that package
Docs::package('package1', $withDocs = true);
Output:
[
"name" => "package1",
"versions" => [
[
"name" => "1.0",
"files" => [
[
"name" => "index.md",
"content" => "# Title"
],
[
"name" => "doc1.md",
"content" => "Doc 1 content"
]
]
],
...
[
"name" => "2.6",
"files" => [ ... ]
]
]
]
If package is not in the docs, result will be null
.
Last bool param $withDocs
is optional and is true by default.
If $withDocs == false
file content
will be null.
Docs::versions('package1', $withDocs = true);
Output:
[
[
"name" => "1.0",
"files" => [
[
"name" => "index.md",
"content" => "# Title"
],
[
"name" => "doc1.md",
"content" => "Doc 1 content"
]
]
],
...
[
"name" => "2.6",
"files" => [ ... ]
]
]
If package is not in the docs, result will be null
.
Last bool param $withDocs
is optional and is true by default.
If $withDocs == false
file content
will be null.
Docs::version('package1', '1.0', $withDocs = true);
Output:
[
"name" => "1.0",
"files" => [
[
"name" => "index.md",
"content" => "# Title"
],
[
"name" => "doc1.md",
"content" => "Doc 1 content"
]
]
]
If package or version is not in the docs, result will be null
.
Last bool param $withDocs
is optional and is true by default.
If $withDocs == false
file content
will be null.
Docs::files('package1', '1.0', $withDocs = true);
Output:
[
[
"name" => "index.md",
"content" => "# Title"
],
[
"name" => "doc1.md",
"content" => "Doc 1 content"
]
]
If package or version is not in the docs, result will be null
.
Last bool param $withDocs
is optional and is true by default.
If $withDocs == false
file content
will be null.
Docs::file('package1', '1.0', 'file.md');
Output:
[
"name" => "index.md",
"content" => "# Title"
]
If package or version or file is not in the docs, result will be null
.
Docs::fileContent('package1', '1.0', 'file.md');
Result is file content string or null
if file does not exists
Docs::list();
Output is array of packages names
[
"package1",
"package2",
...
"package6"
]
Docs::list('package1');
Output is array of package versions names
[
"0.1",
"0.2",
...
"2.18"
]
If package is not in the docs, result will be null
.
Docs::list('package1', '1.0');
Output is array of package version files names
[
"index.md",
"doc1.md",
...
"doc4.md"
]
If package or version is not in the docs, result will be null
.
Docs::list('package1', '1.0', 'file.md');
Result is file content string or null
if file does not exists
You can run the tests with:
composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email :author_email instead of using the issue tracker.
license. Please see the license file for more information.