Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
BurakBoz committed Sep 21, 2023
0 parents commit 77a07d4
Show file tree
Hide file tree
Showing 6 changed files with 599 additions and 0 deletions.
115 changes: 115 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
### Composer template
composer.phar
/vendor/

# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock

### PhpStorm template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### macOS template
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Burak Boz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
94 changes: 94 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Mobiliz API PHP Library

![GitHub](https://img.shields.io/github/license/burakboz/mobiliz)
![GitHub tag (latest SemVer)](https://img.shields.io/github/v/tag/burakboz/mobiliz)
![Packagist Version](https://img.shields.io/packagist/v/burakboz/mobiliz)
![PHP Version](https://img.shields.io/packagist/php-v/burakboz/mobiliz)
![GitHub Workflow Status](https://img.shields.io/github/workflow/status/burakboz/mobiliz/CI)

**Mobiliz API** is a PHP library for interacting with the Mobiliz Tracking Systems API (www.mobiliz.com.tr). It provides an incomplete implementation of the API and is compatible with PHP 7.x and 8.x.

## Notes
**Note**: This library may not fully implement all features of the Mobiliz Tracking Systems API. Use it at your own discretion. Contributions are encouraged to make it more robust and feature-complete.

This piece of code was originally developed for a customer project. They suggested sharing it on GitHub, as others may find it useful.

In short, it was coded in PHP 7.4 as of 2023.

Please note that this is not a complete implementation of the Mobiliz API; we have only implemented what we needed. If you require additional functionality, you can hire me to complete the implementation.

Happy coding!

## Features

- Seamless integration with the Mobiliz Tracking Systems API.
- Simplified access to tracking and related functionalities.
- MIT License - You are free to use this library in your projects.

## Installation

You can install this library via Composer. Run the following command:

```bash
composer require burakboz/mobiliz
```

## Requirements

- PHP >= 7.4
- `ext-curl` extension

## Usage

```php
use BurakBoz\Mobiliz\MobilizClient;

$client = new MobilizClient('your_api_key');

// Example: Get a list of vehicles
$vehicles = $client->vehicles();

// Example: Get last activity information
$activities = $client->activityLast();
```

## Implemented functions
1. `formatPlate`
2. `activityLast`
3. `activityLast`
4. `locations`
5. `drivers`
6. `vehicles`
7. `groups`
8. `fleets`
9. `eventCodes`
10. `properties`
11. `vehicleTypes`
12. `vehicleSubTypes`
13. `violationTypes`
14. `reportCanBusDetail`
15. `reportActivityDetail`

For more detailed usage instructions, please refer to the [examples](https://github.com/burakboz/mobiliz/examples/examples.php).

## Contributing

Contributions are welcome! If you find a bug, have a feature request, or want to contribute code or documentation, please create an issue or pull request in this repository.

## Security

If you discover any security-related issues, please contact us at [[email protected]](mailto:[email protected]).

## License

This library is open-source software licensed under the [MIT License](LICENSE). Feel free to use it in your own projects.

## About the Author

This library is maintained by [Burak Boz](https://www.burakboz.net). You can reach out to the author at [[email protected]](mailto:[email protected]).

## Keywords

mobiliz, library, package, tracking, api

---
44 changes: 44 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "burakboz/mobiliz",
"description": "Mobiliz Tracking Systems www.mobiliz.com.tr php 7.x, 8.x compatible incomplete API implementation",
"license": "MIT",
"type": "library",
"keywords": [
"mobiliz",
"library",
"package",
"tracking",
"api"
],
"authors": [
{
"name": "Burak Boz",
"email": "[email protected]",
"homepage": "https://www.burakboz.net"
}
],
"authorEmail": "[email protected]",
"authorHoldsCopyright": true,
"authorName": "Burak Boz",
"authorUrl": "https://www.burakboz.net",
"githubUsername": "burakboz",
"packageName": "burakboz/mobiliz",
"packageNamespace": "BurakBoz\\Mobiliz",
"projectName": "Mobiliz API",
"securityPolicy": true,
"securityPolicyContactEmail": "[email protected]",
"securityPolicyContactFormUrl": null,
"skipPrompts": true,
"vendorName": "burakboz",
"require": {
"php": ">=7.4",
"ext-curl": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"BurakBoz\\Mobiliz\\": "src/"
}
}
}
53 changes: 53 additions & 0 deletions examples/examples.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* @author Burak Boz
* @email [email protected]
* @package Mobiliz
* @description Example usages of Mobiliz API
*/
require_once "../src/MobilizClient.php";

$apiKey = "use_your_own_api_key_here";
$server = "su0"; // optional server

# Instance example 1
$mobiliz = new \BurakBoz\Mobiliz\MobilizClient($apiKey, $server);

/*
# Instance example 2
$mobiliz = new \BurakBoz\MobilizClient();
$mobiliz->setToken($apiKey); // required
$mobiliz->setServer($server); // optional
*/

/**
* Dumper
* @param $name
* @param $var
* @return void
*/
function dump($name, $var): void
{
$name = "DUMP: " . $name;
$format = PHP_SAPI !== "cli" ? "<h3>%s</h3>\n%s\n<hr>\n" : "%s\n-----\n%s\n-----\n\n";
echo \sprintf($format, $name, \var_export($var, true));
}

/**
* Change ID and Date values with yours to test.
*/
dump("Plate Formatter", $mobiliz->formatPlate("34 pR 91 50 "));
dump("Activity Last", $mobiliz->activityLast());
dump("Activity Last 244291", $mobiliz->activityLast(null,null, null,244291));
dump("locations", $mobiliz->locations());
dump("drivers", $mobiliz->drivers());
dump("vehicles", $mobiliz->vehicles());
dump("groups", $mobiliz->groups());
dump("fleets", $mobiliz->fleets());
dump("eventCodes", $mobiliz->eventCodes());
dump("properties", $mobiliz->properties(1));
dump("vehicleTypes", $mobiliz->vehicleTypes("tr_TR"));
dump("vehicleSubTypes", $mobiliz->vehicleSubTypes(1, "tr_TR"));
dump("violationTypes", $mobiliz->violationTypes("tr_TR"));
dump("reportCanBusDetail", $mobiliz->reportCanBusDetail("2023-01-16T21:00:00.00+00:00","2023-01-20T21:00:00.00+00:00", "tr_TR", null, null, 4028606));
dump("reportActivityDetail", $mobiliz->reportActivityDetail("2023-01-16T21:00:00.00+00:00","2023-01-20T21:00:00.00+00:00", "tr_TR", null, null, 4028606));
Loading

0 comments on commit 77a07d4

Please sign in to comment.