Skip to content

Commit

Permalink
write read me
Browse files Browse the repository at this point in the history
  • Loading branch information
karam-mustafa committed Nov 20, 2020
1 parent 10bb076 commit c480b56
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
## Geographical Calculator

Geographical Calculator was developed for [laravel 5.8+](http://laravel.com/) to facilitate future geographical searches
this package is implement for now a simple distance calculation between tow geographical points

Installation
------------
##### 1 - Dependency
The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:

```shell
composer require kmlaravel/laravel-geographical-calculator
```
- #### Laravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
##### 3 - Copy the package providers to your local config with the publish command , this will publish asset and config :
```shell
php artisan vendor:publish --provider="KMLaravel\GeographicalCalculator\Providers\GeographicalCalculatorServiceProviders"
```
- #### or you may publish asset and config separately.
##### 3 - Copy the package config to your local config with the publish command:
```shell
php artisan vendor:publish --tag=geographical-calculator-config
```

Basic usage
-----------
##### basic example
```php
// define your values
// $class = \KMLaravel\GeographicalCalculator\Facade\GeographicalCalculatorFacade::initCoordinates($firstLat , $secondLat , $firstLon , $secondLon , ['units' => ['km']]);
$class = \KMLaravel\GeographicalCalculator\Facade\GeographicalCalculatorFacade::initCoordinates(22,33,37,40 , ['units' => ['km']]);
return $class->getLength();
// the result is array contains values based on your units options insertion [ "km" => 1258.1691302282 ]
```


config options
----------------
> ## add your custom units
>
```php
/*
|--------------------------------------------------------------------------
| units values
|--------------------------------------------------------------------------
| your custom units , the initial units its convert from mile to any value
| (1.609344) is the conversion factor from mile to kilometer
*/
'units' => [
'mile' => 1,
'km' => 1.609344,
'm' => (1.609344 * 1000),
'cm' => (1.609344 * 100),
'mm' => (1.609344 * 1000 * 1000),
],
```

Changelog
---------
Please see the [CHANGELOG](https://github.com/kmlaravel/laravel-geographical-calculator/blob/master/CHANGELOG.md) for more information about what has changed or updated or added recently.

Security
--------
If you discover any security related issues, please email them first to karam2mustafa@gmail.com,
if we do not fix it within a short period of time please open new issue describe your problem.

Credits
-------
[karam mustafa](https://www.linkedin.com/in/karam2mustafa)

0 comments on commit c480b56

Please sign in to comment.