{"id":34676143,"url":"https://github.com/nanoblocktech/shipping-calculator","last_synced_at":"2026-05-28T09:32:13.167Z","repository":{"id":207468570,"uuid":"719301350","full_name":"nanoblocktech/shipping-calculator","owner":"nanoblocktech","description":"Determines the shipping fee based on the customer's longitude and latitude to the business location.","archived":false,"fork":false,"pushed_at":"2023-12-21T18:16:37.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-05T15:36:49.476Z","etag":null,"topics":["distance-calculator","gps","php","php-shipping-class","shipping-calculator","shipping-distance"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nanoblocktech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-11-15T21:59:45.000Z","updated_at":"2023-12-17T10:03:42.000Z","dependencies_parsed_at":"2023-11-16T00:34:20.973Z","dependency_job_id":"5304f975-9728-4e7a-aedd-a458f93c1806","html_url":"https://github.com/nanoblocktech/shipping-calculator","commit_stats":null,"previous_names":["nanoblocktech/shipping-calculator"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/nanoblocktech/shipping-calculator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoblocktech%2Fshipping-calculator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoblocktech%2Fshipping-calculator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoblocktech%2Fshipping-calculator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoblocktech%2Fshipping-calculator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nanoblocktech","download_url":"https://codeload.github.com/nanoblocktech/shipping-calculator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nanoblocktech%2Fshipping-calculator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33603474,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["distance-calculator","gps","php","php-shipping-class","shipping-calculator","shipping-distance"],"created_at":"2025-12-24T20:53:00.294Z","updated_at":"2026-05-28T09:32:13.160Z","avatar_url":"https://github.com/nanoblocktech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Class Shipping Calculator\n\nDetermines the shipping fee based on the customer's longitude and latitude to the business location.\n\n### Functions\n\n- Calculates the distance between business and customer locations\n- Determines the shipping fee based on the provided charge per distance.\n- Determines the estimated traveling time based on distance and speed\n\nInstallation Guide via Composer:\n\n```bash\ncomposer require nanoblocktech/shipping-calculator\n```\n\n### Usages \n\n```php\nuse Luminova\\ExtraUtils\\ShippingCalculator;\n\n$calculator = new ShippingCalculator();\n\n// Set business and customer locations\n\n$calculator-\u003esetOrigin(6.47427, 7.56196); // Business location (Enugu Airport Nigeria)\n$calculator-\u003esetDestination(6.51181, 7.35535); // Customer location (Udi Nigeria)\n$calculator-\u003esetCharge(100); // Initial shipping cost per distance km, or ml\n\n// Calculate distance and return new ShippingDistance instance class\n\n$distance = $calculator-\u003egetDistance();\n\n// Get the estimated time information\n\n$time = $calculator-\u003egetTime();\n\n// Get your calculated information\n\necho \"Distance: $distance-\u003etoDistance() \\n\";\necho \"Distance[km|ml]: $distance-\u003etoString() \\n\";\necho \"Shipping Fee: $distance-\u003egetCurrency(2)\\n\";\necho \"Shipping Fee: $distance-\u003egetCharges()\\n\";\n```\n\n### Methods \n\n#### ShippingCalculator\n\nSetting up your calculations `$calculator = new ShippingCalculator(ShippingCalculator::KM);`\n\nMethods And Param                                       |  Descriptions \n--------------------------------------------------------|-----------------------------------------------------\nsetOrigin(float latitude, float longitude): self        | Set the origin location latitude and longitude\nsetDestination(float latitude, float longitude): self   | Set the destination location latitude and longitude\nsetCharge(float amount): self                           | Set initial shipping charge per calculation distance\nsetSpeed(int speed): self                               | Set speed in units per hour, to calculate estimated time.\ngetDistance(): ShippingDistance                         | Calculate the distance between the origin/destination and return distance instance.\n\n#### ShippingDistance\n\nThe method which `$distance = $calculator-\u003egetDistance();` is returned \n\nMethods And Param                                       |  Descriptions \n--------------------------------------------------------|-----------------------------------------------------------------------------------------\ntoDistance(): float                                     | Get the calculated distance between the origin and destination latitude and longitude.\ntoString(): string                                      | Get the distance as a string (e.g., '10km').\ntoCurrency(int decimals = 2, string symbol): string     | Convert the distance to currency format with optional currency symbol and decimal places.\ntoMile(): float                                         | Convert the distance from kilometer to miles.\ntoKilometer(): float                                    | Convert the distance from miles to kilometers.\ngetCurrency(int decimal = 2): string                    | Get the calculated currency value based on the distance and initial amount.\ngetCharges(): float                                     | Get the calculated charges\ngetTime(): ShippingTime                                 | Get distance time instance\n\n#### ShippingTime\n\nThe method which `$time = $distance-\u003egetTime();` is returned \n\nMethods And Param                                       |  Descriptions \n--------------------------------------------------------|-----------------------------------------------------------------------------------------\ntoTime(): float                                         | Get the calculated time required to cover the distance.\ntoHours(): int                                          | Convert the total time to hours.\ntoSeconds(): int                                        | Get the total time in seconds.\ntoMinutes(): int                                        | Convert the total time to minutes.\ntoDays(): int                                           | Convert the total time to days.\ntoString(): string                                      | Get a formatted string representation of the total time.\ntoObject(): object                                      | Get an object representation of the total time.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoblocktech%2Fshipping-calculator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnanoblocktech%2Fshipping-calculator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnanoblocktech%2Fshipping-calculator/lists"}