-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Sander0542/feature/about
About page
- Loading branch information
Showing
9 changed files
with
238 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Http\Request; | ||
use Inertia\Inertia; | ||
use MCStreetguy\ComposerParser\Factory as ComposerParser; | ||
|
||
class AboutController extends Controller | ||
{ | ||
public function index() | ||
{ | ||
$versionFilePath = public_path('version'); | ||
$applicationVersion = 'Unknown'; | ||
if (file_exists($versionFilePath)) { | ||
$applicationVersion = file_get_contents($versionFilePath); | ||
} | ||
|
||
$composerFile = ComposerParser::parseComposerJson(base_path('composer.json')); | ||
$composerLock = ComposerParser::parseLockfile(base_path('composer.lock')); | ||
$composerPackages = collect($composerLock->getPackages()->getData())->map(function ($package) { | ||
return [ | ||
'name' => $package['name'], | ||
'description' => $package['description'] ?? null, | ||
'version' => $package['version'], | ||
'licenses' => $package['license'] ?? [], | ||
]; | ||
})->toArray(); | ||
|
||
$npmJson = json_decode(file_get_contents(base_path('package-lock.json')), true); | ||
$npmPackages = collect($npmJson['packages']['']['devDependencies'])->map(function ($version, $package) use ($npmJson) { | ||
return $npmJson['dependencies'][$package]['version']; | ||
}); | ||
|
||
return Inertia::render('About/Index', [ | ||
'application' => [ | ||
'about' => [ | ||
'Authors' => collect($composerFile->getAuthors())->map(function ($author) { | ||
return $author->getName(); | ||
}), | ||
'License' => $composerFile->getLicense()[0], | ||
], | ||
'versions' => [ | ||
'Application' => $applicationVersion, | ||
'PHP' => phpversion(), | ||
'Laravel' => app()->version(), | ||
], | ||
'extensions' => collect(get_loaded_extensions())->mapWithKeys(function ($extension) { | ||
return [$extension => phpversion($extension)]; | ||
})->toArray(), | ||
'libraries' => [ | ||
'composer' => $composerPackages, | ||
'npm' => $npmPackages, | ||
], | ||
], | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,19 @@ | |
"name": "sander0542/network-manager", | ||
"type": "project", | ||
"description": "The Laravel Framework.", | ||
"keywords": ["framework", "laravel"], | ||
"keywords": [ | ||
"framework", | ||
"laravel" | ||
], | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
"name": "Sander Jochems", | ||
"email": "[email protected]", | ||
"homepage": "https://sanderjochems.com", | ||
"role": "Founder" | ||
} | ||
], | ||
"require": { | ||
"php": "^8.0", | ||
"fruitcake/laravel-cors": "^2.0", | ||
|
@@ -15,6 +26,7 @@ | |
"laravel/sanctum": "^2.11", | ||
"laravel/tinker": "^2.5", | ||
"markrogoyski/ipv4-subnet-calculator": "^3.1", | ||
"mcstreetguy/composer-parser": "^1.1", | ||
"tightenco/ziggy": "^1.0" | ||
}, | ||
"require-dev": { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<template> | ||
<app-layout title="About"> | ||
<template #header> | ||
<h2 class="h4 font-weight-bold"> | ||
About | ||
</h2> | ||
</template> | ||
|
||
<div class="row"> | ||
<div class="col-4"> | ||
<div class="card"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Application</h5> | ||
<table class="table table-borderless"> | ||
<tr v-for="(information, title) in application.about"> | ||
<th>{{ title }}</th> | ||
<td v-if=" typeof information == 'object'" v-for="item in information">{{ item }}</td> | ||
<td v-else>{{ information }}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="card mt-4"> | ||
<div class="card-body"> | ||
<h5 class="card-title">Versions</h5> | ||
<table class="table table-borderless"> | ||
<tr v-for="(version, type) in application.versions"> | ||
<th>{{ type }}</th> | ||
<td>{{ version }}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="card mt-4"> | ||
<div class="card-body"> | ||
<h5 class="card-title">PHP Extensions</h5> | ||
<table class="table table-borderless"> | ||
<tr v-for="(version, extension) in application.extensions"> | ||
<th>{{ extension }}</th> | ||
<td>{{ version }}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
<div class="card mt-4"> | ||
<div class="card-body"> | ||
<h5 class="card-title">NPM Packages</h5> | ||
<table class="table table-borderless"> | ||
<tr v-for="(version, library) in application.libraries.npm"> | ||
<th>{{ library }}</th> | ||
<td>{{ version }}</td> | ||
</tr> | ||
</table> | ||
</div> | ||
</div> | ||
</div> | ||
<div class="col-8"> | ||
<div class="card"> | ||
<div class="card-body pb-0"> | ||
<h5 class="card-title m-0">Composer Packages</h5> | ||
</div> | ||
<ul class="list-group"> | ||
<li v-for="library in application.libraries.composer" class="list-group-item d-flex justify-content-between align-items-center border-0 border-bottom"> | ||
<div class="me-auto"> | ||
<div class="fw-bold">{{ library.name }}</div> | ||
{{ library.description }} | ||
</div> | ||
<span v-for="license in library.licenses" class="badge bg-success rounded-pill me-1">{{ license }}</span> | ||
<span class="badge bg-success rounded-pill">{{ library.version }}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</app-layout> | ||
</template> | ||
|
||
<script> | ||
import {defineComponent} from "vue" | ||
import AppLayout from "@/Layouts/AppLayout.vue" | ||
export default defineComponent({ | ||
components: { | ||
AppLayout, | ||
}, | ||
props: { | ||
application: Object | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters