{"id":20940036,"url":"https://github.com/bostaapp/bosta-php","last_synced_at":"2025-05-13T22:32:08.849Z","repository":{"id":62496211,"uuid":"293782073","full_name":"bostaapp/bosta-php","owner":"bostaapp","description":"A PHP client SDK for Bosta APIs integration.","archived":false,"fork":false,"pushed_at":"2020-10-07T12:32:50.000Z","size":43,"stargazers_count":2,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-02T09:37:28.563Z","etag":null,"topics":["api-integration","bosta","client-sdk","composer","courier","php"],"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/bostaapp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-08T10:52:46.000Z","updated_at":"2023-03-05T15:06:07.000Z","dependencies_parsed_at":"2022-11-02T11:45:37.731Z","dependency_job_id":null,"html_url":"https://github.com/bostaapp/bosta-php","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostaapp%2Fbosta-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostaapp%2Fbosta-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostaapp%2Fbosta-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bostaapp%2Fbosta-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bostaapp","download_url":"https://codeload.github.com/bostaapp/bosta-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254036819,"owners_count":22003657,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["api-integration","bosta","client-sdk","composer","courier","php"],"created_at":"2024-11-18T23:08:39.559Z","updated_at":"2025-05-13T22:32:05.507Z","avatar_url":"https://github.com/bostaapp.png","language":"PHP","readme":"# Bosta PHP SDK\n\nThis repository contains the open source PHP SDK for integrating Bosta's APIs into your PHP application.\n\n## Table of Contents\n\n- [APIs Documentation](#apis-documentation)\n- [Installation](#installation)\n- [Usages](#usages)\n- [Contribution](#contribution)\n- [License](#license)\n\n## APIs Documentation\n\n- [Staging](https://stg-app.bosta.co/docs) APIs swagger documentation.\n- [Production](https://app.bosta.co/docs) APIs swagger documentation.\n\n## Installation\n\nYou can install the package via [Composer](https://getcomposer.org/). Run the following command:\n\n``` bash\n$ composer require bosta/bosta-sdk\n```\n\n## Usages\n\n- Environment Variable Config\n    ``` php\n    $stgBaseUrl = 'https://stg-app.bosta.co';\n    $prodBaseUrl = 'https://app.bosta.co';\n    \n    putenv(\"API_KEY=$your api key\");\n    putenv(\"BASE_URL=$your base url\");\n    ```\n\n- Bosta Client\n    ``` php\n    require __DIR__ . '/vendor/autoload.php';\n    use Bosta\\Bosta;\n    $bosta = new Bosta(getenv(\"API_KEY\"), getenv(\"BASE_URL\"));\n    ```\n\n- Pickup Client\n    ``` php\n    use Bosta\\Utils\\ContactPerson;\n\n    /**\n    * List Pickup Request\n    *\n    * @param int $pageNumber = 0\n    * @return \\stdClass\n    */\n    try {\n        $list = $bosta-\u003epickup-\u003elist(0);\n        echo \"list: \\n\";\n        var_dump($list);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Get Pickup Request\n    *\n    * @param string $pickupRequestId = 070000000386\n    * @return \\stdClass\n    */\n    try {\n        $get = $bosta-\u003epickup-\u003eget('070000000386');\n        echo \"get: \\n\";\n        var_dump($get);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Delete Pickup Request\n    *\n    * @param string $pickupRequestId = 070000000386\n    * @return string\n    */\n    try {\n        $delete = $bosta-\u003epickup-\u003edelete('070000000386');\n        echo \"delete: \\n\";\n        var_dump($delete);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Create ContactPerson Instance\n    *\n    * @param string $name = aliaa123\n    * @param string $phone = 01209847552\n    * @param string $email = test@test.com\n    */\n    $contactPerson = new ContactPerson(\"aliaa123\", \"01209847552\", 'test@test.com');\n\n    /**\n    * Get Pickup Locations to use its id in create pickup Request\n    */\n    try {\n        $listPickupLocations = $bosta-\u003epickupLocation-\u003elist();\n        echo \"listPickupLocations: \\n\";\n        var_dump($listPickupLocations);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Create Pickup Request\n    *\n    * @param string $scheduledDate = 2020-09-30 (YYYY-MM-DD)\n    * @param string $scheduledTimeSlot = 10:00 to 13:00 || 13:00 to 16:00\n    * @param \\Bosta\\Utils\\ContactPerson $contactPerson\n    * @param string $businessLocationId = SkIvXQn_a\n    * @param string $notes = ''\n    * @param int $noOfPackages = 0\n    * @return \\stdClass\n    */\n    try {\n        $create = $bosta-\u003epickup-\u003ecreate('2020-09-30', '10:00 to 13:00', $contactPerson, 'SkIvXQn_a', '', 0);\n        echo \"create: \\n\";\n        var_dump($create);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n\n    /**\n    * Update Pickup Request\n    *\n    * @param string $pickupRequestId = 070000000386\n    * @param string $scheduledDate = 2020-09-29 (YYYY-MM-DD)\n    * @param string $scheduledTimeSlot = 10:00 to 13:00 || 13:00 to 16:00\n    * @param \\Bosta\\Utils\\ContactPerson $contactPerson\n    * @param string $businessLocationId = SkIvXQn_a\n    * @param string $notes = ''\n    * @param int $noOfPackages = 0\n    * @return string\n    */\n    try {\n        $update = $bosta-\u003epickup-\u003eupdate('070000000386', '2020-09-29', '10:00 to 13:00', $contactPerson, 'SkIvXQn_a', '', 0);\n        echo \"update: \\n\";\n        var_dump($update);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n    ```\n\n- Delivery Client\n    ``` php\n    use Bosta\\Utils\\Receiver;\n    use Bosta\\Utils\\DropOffAddress;\n\n    /**\n    * List Deliveries\n    *\n    * @param int $pageNumber = 0\n    * @param int $pageLimit = 50\n    * @return \\stdClass\n    */\n    try {\n        $list = $bosta-\u003edelivery-\u003elist(0, 50);\n        echo \"list: \\n\";\n        var_dump($list);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * get Delivery\n    *\n    * @param string $trackingNumber = 3082253\n    * @return \\stdClass\n    */\n    try {\n        $get = $bosta-\u003edelivery-\u003eget('3082253');\n        echo \"get: \\n\";\n        var_dump($get);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Delete Delivery\n    *\n    * @param string $deliveryId = cZTghcUW6E\n    * @return void\n    */\n    try {\n        $delete = $bosta-\u003edelivery-\u003edelete('cZTghcUW6E');\n        echo \"delete: \\n\";\n        var_dump($delete);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Create Receiver Instance\n    *\n    * @param string $firstName = BostaDevTeam\n    * @param string $lastName = lastname\n    * @param string $phone = 01025810012\n    */\n    $receiver = new Receiver(\"BostaDevTeam\", \"lastname\", '01025810012');\n\n    /**\n    * Create DropOffAddress Instance\n    *\n    * @param int $buildingNumber = 1\n    * @param string $firstLine = firstLine\n    * @param string $city = EG-05\n    * @param string $zone = Dakahlia\n    */\n    $dropOffAddress = new DropOffAddress(1, \"firstLine\", \"EG-05\", 'Dakahlia');\n\n    /**\n    * Create Delivery\n    *\n    * @param int $type = 10\n    * @param \\Bosta\\Utils\\DropOffAddress $dropOffAddress\n    * @param \\Bosta\\Utils\\Receiver $receiver\n    * @param string $notes = ''\n    * @param int $cod = 0\n    * @return \\stdClass\n    */\n    try {\n        $create = $bosta-\u003edelivery-\u003ecreate(10, $dropOffAddress, $receiver, '', 0);\n        echo \"create: \\n\";\n        var_dump($create);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n\n    /**\n    * Create Receiver Instance\n    *\n    * @param string $firstName = BostaDevTeam\n    * @param string $lastName = lastname\n    * @param string $phone = 01025810012\n    */\n    $receiver = new Receiver(\"BostaDevTeam\", \"lastname\", '01025810012');\n\n    /**\n    * Create DropOffAddress Instance\n    *\n    * @param int $buildingNumber = 1\n    * @param string $firstLine = firstLine\n    * @param string $city = EG-05\n    * @param string $zone = Dakahlia\n    */\n    $dropOffAddress = new DropOffAddress(1, \"firstLine\", \"EG-05\", 'Dakahlia');\n\n    /**\n    * Update Delivery\n    *\n    * @param string $deliveryId = Dsu5bShCHK\n    * @param \\Bosta\\Utils\\DropOffAddress $dropOffAddress\n    * @param \\Bosta\\Utils\\Receiver $receiver\n    * @param string $notes = ''\n    * @param int $cod = 10\n    * @return string\n    */\n    try {\n        $update = $bosta-\u003edelivery-\u003eupdate('Dsu5bShCHK', $dropOffAddress, $receiver, '', 10);\n        echo \"update: \\n\";\n        var_dump($update);\n        echo \"------------------------------------------ \\n\";\n    } catch (Exception $e) {\n        echo 'Caught exception: ',  $e-\u003egetMessage(), \"\\n\";\n    }\n    ```\n\n## Contribution\n\nWe are open to, and grateful for, any contributions made by the community.\nBy contributing to Bosta, you agree to abide by the code of conduct.\n- [Contributing Guide](CONTRIBUTING.md) \n- [Code of Conduct](CODE_OF_CONDUCT.md)\n\n## License\n\nThe MIT License (MIT) [License](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbostaapp%2Fbosta-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbostaapp%2Fbosta-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbostaapp%2Fbosta-php/lists"}