{"id":18463912,"url":"https://github.com/badchoice/handesk-php","last_synced_at":"2025-04-08T07:32:52.162Z","repository":{"id":37270066,"uuid":"100286833","full_name":"BadChoice/handesk-php","owner":"BadChoice","description":"Handesk php sdk","archived":false,"fork":false,"pushed_at":"2023-02-01T22:50:18.000Z","size":70,"stargazers_count":14,"open_issues_count":4,"forks_count":15,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T08:51:12.305Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BadChoice.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-14T16:17:10.000Z","updated_at":"2021-12-25T02:30:04.000Z","dependencies_parsed_at":"2023-02-17T12:00:21.852Z","dependency_job_id":null,"html_url":"https://github.com/BadChoice/handesk-php","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2Fhandesk-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2Fhandesk-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2Fhandesk-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BadChoice%2Fhandesk-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BadChoice","download_url":"https://codeload.github.com/BadChoice/handesk-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247796356,"owners_count":20997553,"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":[],"created_at":"2024-11-06T09:08:21.762Z","updated_at":"2025-04-08T07:32:51.921Z","avatar_url":"https://github.com/BadChoice.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### A Handesk PHP sdk \n\nCheck the full project at [https://github.com/BadChoice/handesk](https://github.com/BadChoice/handesk)\n\n### Installation\n\n```\ncomposer require badchoice/handesk-php\n```\n\n#### Usage \n#### Initializaion\nTo initialize the Handesk-php sdk you simply need to call to\n\n```\nHandesk::setup('your-handesk-url', 'your-handesk-api-token');\n```\n\nIf you use laravel you can use the `config/services.php` file and do it like this \n\n```php\n// In AppServiceProvider boot method\nHandesk::setup(config('services.handesk.url'), config('services.handesk.token'));\n```\n\n```php\n    //In config.services.php file\n    'handesk' =\u003e [\n        'url'   =\u003e env('HANDESK_URL', 'http://handesk.dev/api'),\n        'token' =\u003e env('HANDESK_TOKEN', 'the-api-token')\n    ],\n```\n\n\n##### Tickets\nTo get the open tickets for a requester (it only returns the ticket header, see find below to get the full ticket) \n\n```php\n$tickets = (new Ticket)-\u003eget('requesterNameOrEmail');\n```\n\nYou can ask for the closed, or solved adding a second parameter\n\n```php\n$solvedTickets = (new Ticket)-\u003eget('requesterNameOrEmail','solved');\n$openTickets = (new Ticket)-\u003eget('requesterNameOrEmail','solved');\n```\n\nYou can create new tickets as well\n\n```php\n$ticket_id = (new Ticket)-\u003ecreate(\n    [\"name\" =\u003e \"Requester name\", \"email\" =\u003e \"requester@email.com\"], \n    \"The ticket subject\", \n    \"The ticket initial body\", \n    [\"tag1\",\"tag2\"]\n   );\n```\n\nAnd then fetch a ticket\n\n```php\n$ticket = (new Ticket)-\u003efind($id);\n$comments = $ticket-\u003ecomments; //Includes the initial comment\n$comments-\u003efirst()-\u003erequester; // [\"name\" =\u003e \"Requester name\", \"email\" =\u003e \"Requester email\"]\n```\n\nAdding comments to tickets\n```php\n$ticket-\u003eaddComment(\"Adding a comment\");\n$ticket-\u003eaddComment(\"Adding a comment and solving the ticket\", true);\n```\n\n##### Teams\n```php\n    $team = Team::create(\"team name\", \"team email\";\n    (new Team(2))-\u003etickets();           //gets all open tickets for team with id 2\n    (new Team(2))-\u003etickets('solved');   //gets all solved tickets for team with id 2\n    (new Team(2))-\u003eticketsCount();      //gets the count of all open tickets for team with id 2\n    (new Team(2))-\u003eticketsCount('closed'); //gets the count of all closed tickets for team with id 2\n    \n    (new Team(2))-\u003eleads();      //gets the open leads for a team (paginated)\n    (new Team(2))-\u003eleadsCount(); //gets the count of all live leads for team with id 2\n```\n\n\n\n##### Leads\n\nTo create a lead simply call:\n```php\n$id = (new Lead)-\u003ecreate([\n            \"email\"       =\u003e \"bruce@wayne.com\",\n            \"body\"        =\u003e \"I'm interested in buying this awesome app\",\n            \"username\"    =\u003e \"brucewayne\",\n            \"name\"        =\u003e \"Bruce Wayne\",\n            \"phone\"       =\u003e \"0044 456 567 54\",\n            \"address\"     =\u003e \"Wayne manner\",\n            \"city\"        =\u003e \"Gotham\",\n            \"postal_code\" =\u003e \"90872\",\n            \"company\"     =\u003e \"Wayne enterprises\"]\n            ,\n            [\"lightning\",\"handesk\"]\n        );\n```\n\u003e Only `name` is a required field\n\n#### Development\nPRs welcome\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadchoice%2Fhandesk-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbadchoice%2Fhandesk-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbadchoice%2Fhandesk-php/lists"}