https://github.com/ml-opensource/n-meta-laravel
https://github.com/ml-opensource/n-meta-laravel
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ml-opensource/n-meta-laravel
- Owner: ml-opensource
- License: mit
- Created: 2020-03-30T14:01:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T10:02:41.000Z (about 2 years ago)
- Last Synced: 2025-07-26T21:50:41.836Z (10 months ago)
- Language: PHP
- Size: 85 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# N-Meta Laravel
[](https://scrutinizer-ci.com/g/nstack-io/laravel-sdk/?branch=master)
[](https://scrutinizer-ci.com/g/nstack-io/laravel-sdk/?branch=master)
[](https://scrutinizer-ci.com/g/nstack-io/laravel-sdk/build-status/master)
[](https://scrutinizer-ci.com/code-intelligence)
## 📝 Introduction
Package to enforce & parse Meta header (Default: "Client-Meta-Information")
`Client-Meta-Information: [PLATFORM];[ENVIRONMENT];[APP_VERSION];[DEVICE_OS];[DEVICE]`
## 📦 Installation
To install this package you will need:
* PHP 7.1+
Run
`composer require monstar-lab-oss/n-meta-laravel`
or setup in composer.json
`monstar-lab-oss/n-meta-laravel: 1.0.x`
In `config/app.php` (Laravel) or `bootstrap/app.php` (Lumen) you should add service provider
```php
NMeta\ServiceProvider::class
```
Copy config over from vendor/monstar-lab-oss/n-meta-laravel/config/n-meta.php to project/config/n-meta.php
```
php artisan vendor:publish --provider="NMeta\ServiceProvider"
```
## ⚙ Usage
Add middleware to routes:
```php
// in RouteServiceProvider
protected function mapApiRoutes()
{
Route::prefix('api')
->middleware('api')
->middleware(NMetaMiddleware::class) // Add NMeta middleware
->namespace($this->namespace)
->group(base_path('routes/api.php'));
}
```
You can now call via function, eg:
```php
nmeta()->getPlatform()
nmeta()->getVersion()
```
## 🏆 Credits
This package is developed and maintained by the PHP team at [Monstar Lab](http://monstar-lab.com)
## 📄 License
This package is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)