{"id":17180427,"url":"https://github.com/agoalofalife/bpm-online","last_synced_at":"2025-04-13T17:13:18.338Z","repository":{"id":56942106,"uuid":"64830500","full_name":"agoalofalife/bpm-online","owner":"agoalofalife","description":"Package for working with bpm’online ","archived":false,"fork":false,"pushed_at":"2018-07-05T12:13:24.000Z","size":1140,"stargazers_count":8,"open_issues_count":3,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-13T17:12:50.638Z","etag":null,"topics":["bpm","bpm-api","bpm-online","laravel"],"latest_commit_sha":null,"homepage":"","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/agoalofalife.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":"2016-08-03T08:48:38.000Z","updated_at":"2021-05-06T09:52:12.000Z","dependencies_parsed_at":"2022-08-21T02:10:21.771Z","dependency_job_id":null,"html_url":"https://github.com/agoalofalife/bpm-online","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agoalofalife%2Fbpm-online","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agoalofalife%2Fbpm-online/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agoalofalife%2Fbpm-online/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agoalofalife%2Fbpm-online/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agoalofalife","download_url":"https://codeload.github.com/agoalofalife/bpm-online/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750127,"owners_count":21155687,"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":["bpm","bpm-api","bpm-online","laravel"],"created_at":"2024-10-15T00:29:35.799Z","updated_at":"2025-04-13T17:13:18.314Z","avatar_url":"https://github.com/agoalofalife.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"### API BPM ONLINE\n\n[![Build Status](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/badges/build.png?b=master)](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/build-status/master)\n[![Twitter](https://img.shields.io/twitter/url/https/github.com/agoalofalife/geography.svg?style=social\u0026style=plastic)](https://twitter.com/intent/tweet?text=Wow:\u0026url=%5Bobject%20Object%5D) \n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/?branch=master)\n[![Code Coverage](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/agoalofalife/bpm-online/?branch=master)\n  [![License](https://poser.pugx.org/agoalofalife/geography/license)](https://packagist.org/packages/agoalofalife/geography)\n\n[RU](#RU) | [EN](#EN)\n\n\u003ca name=\"RU\"\u003e\u003c/a\u003e\n**Что это такое?**\n\n\nПакет предоставляет удобный интерфейс для работы с [API Bpm’online](https://academy.terrasoft.ru/documents/technic-sdk/7-8/rabota-s-obektami-bpmonline-po-protokolu-odata-s-ispolzovaniem-http-zaprosov) через протокол OData.\n\n- [Установка](#Installation)\n- [Настройка конфигураций](#Config)\n- [Аутенфикация](#Authentication)\n- [Установка коллекции](#SetCollection)\n- [Основные запросы](#BasesRequest)\n    - [Select](#Select)\n    - [Create](#Create)\n    - [Update](#Update)\n    - [Delete](#Delete)\n- [Обработчики  ответов](#Handler)\n- [Логирование](#Log)\n- [Интеграция с Laravel](#Laravel)\n- [Инструмент](#Tools)\n\n\n\n\u003ca name=\"Installation\"\u003e\u003c/a\u003e\n## Установка\n\nДля установки необходимо выполнить команду из composer\n\n    \n    composer require agoalofalife/bpm-online\n\u003ca name=\"Config\"\u003e\u003c/a\u003e\n## Настройка конфигураций\n\nДля установки ваших конфигурационных данных есть несколько способов :\n\n - Через class File\n \n```\n //Инициализируем ядро\n $kernel = new KernelBpm();\n $file = new File();\n \n // указываем путь до файла с  конфигурациями\n $file-\u003esetSource(__DIR__ . '/config/apiBpm.php');\n // Загружаем их\n $kernel-\u003eloadConfiguration($file);\n```\n\nФайл должен возвращать массив с конфигурационными данными \n```\nreturn [\n\t// url для аутентификации\n    'UrlLogin' =\u003e '',\n    //ваш url для запросов по api       \n    'UrlHome'  =\u003e '',\n    'Login'    =\u003e '',\n    'Password' =\u003e ''\n    ]\n```\n\n - Через метод setConfigManually в KernelBpm\n\n```\n$kernel = new KernelBpm();\n// первым параметром передается префикс для конфигурации\n$$kernel-\u003esetConfigManually('apiBpm', [\n        'UrlLogin' =\u003e '',\n        'Login'    =\u003e '',\n        'Password' =\u003e '',\n        'UrlHome'  =\u003e ''\n]);\n```\n\u003ca name=\"Authentication\"\u003e\u003c/a\u003e\n## Аутенфикация\nДля аутенфикация в BPM API необходимо получить cookie по URL `https://ikratkoe.bpmonline.com/ServiceModel/AuthService.svc/Login`\nДля этого необходимо вызвать метод `authentication`\n\n```\n$kernel-\u003eauthentication();\n```\nМожно не вызывать его и пакет автоматически обновит куки сделав дополнительный запрос.\n\n\u003ca name=\"SetCollection\"\u003e\u003c/a\u003e\n\n## Установка коллекции\n\nВ BPM все таблицы из базы данных именуются как коллекции ( Collections )\nДля взаимодействия необходимо установить коллекцию.\n\n```\n$kernel-\u003esetCollection('CaseCollection');\n```\nДанный подход имеет минус в дополнительном вызове метода `setCollection` , но позволяет переиспользывать установку коллекции.\nИмеется в виду что мы можем один раз установить коллекцию и производить операции по ней.\n\n\n\u003ca name=\"BasesRequest\"\u003e\u003c/a\u003e\n\n\u003ca name=\"Select\"\u003e\u003c/a\u003e\n\n## Select\n\nВсе методы принимают первым параметром строку типа операции и тип данных, вторым параметром callback внутрь которого передается тип операции, внутри callback происходит выполнение всех пред - настроек в конце вызывается метод get.\nВозращается обьект типа  Handler который обрабатывает ответ от BPM.\n\n```\n$handler = $kernel-\u003eaction('read:json', function ($read){\n    $read-\u003eamount(1)-\u003eskip(100);\n\n})-\u003eget();\n\n```\nВсего два типа данных `xml` и `json`.\nЧетыре вида операции `read`, `create`, `update`, `delete`.\n\n**Методы Select**\n\n**filterConstructor** \nПозволяет фильтровать выборку с помощью функции $filter  в запросе\n```\nfilterConstructor('Id eq guid\\'00000000-0000-0000-0000-000000000000\\'');\n```\n**orderBy** \nПолучать данные в отсортированном виде\nПервым параметром название поля, вторым параметром тип сортировки :\nпо возрастанию (asc)\nпо убыванию (desc)\n```\n-\u003eorderby('Number', 'desc')\n```\n\n**skip** \nЕсли необходимо пропустить заданное кол - во записей\n\n```\n-\u003eskip(10)\n```\n\n**amount**\nЗадать максимальное кол - во записей\n\n```\n-\u003eamount(100)\n```\n`Имейте в виду что вы можете комбинировать методы согласно документации Bpm’online`\n\n\u003ca name=\"Create\"\u003e\u003c/a\u003e\n## Create\n\nСинтаксис для создания записи такой же как и Select.\nВнутри callback необходимо вызвать метод setData и передать ему массив параметров для создания записи в таблице BPM.\n```\n$handler = $kernel-\u003eaction('create:xml', function ($creator){\n    $creator-\u003esetData([\n        // array key =\u003e value\n    ]);\n})-\u003eget();\n```\n\n\u003ca name=\"Update\"\u003e\u003c/a\u003e\n## Update\nДля обновления данных в записи в BPM необходимо знать guid записи.\nЗдесь устанавливается guid и новые параметры для обновления.\n```\n$handler = $kernel-\u003eaction('update:json', function ($creator){\n    $creator-\u003eguid('')-\u003esetData([\n       'Number' =\u003e ''\n    ]);\n})-\u003eget();\n```\n\u003ca name=\"Delete\"\u003e\u003c/a\u003e\n## Delete\nДля удаление записи из бд достаточно знать guid\n```\n$handler = $kernel-\u003eaction('delete:xml', function ($creator){\n    $creator-\u003eguid('');\n})-\u003eget();\n```\n\n\u003ca name=\"Handler\"\u003e\u003c/a\u003e\n## Обработчики  ответов\n\nВне зависимости от операции всегда возращается тип  Handler, который иммеет несколько методов для преобразования данных.\n\n**toArray**\nПреобразовывает данные в массив\n\n**toJson**\nПреобразовывает данные в json\n\n**getData**\nПолучить данные как есть\n\n\u003ca name=\"Log\"\u003e\u003c/a\u003e\n## Логирование\n\nНа данный момент пакет сохраняет внутри себя детализацию всех запросов с сортировкой по дате.\nИх можно найти в `src/resource/logs/...`\n\n\u003ca name=\"Laravel\"\u003e\u003c/a\u003e\n## Интеграция с Laravel\n\nДля интеграции с фреймворком Laravel необходимо скопировать конфигурации и заполнить их\n\n```\n php artisan vendor:publish --tag=bpm --force\n```\nВставить сервис провайдер в файл `config/app.php`\n\n```\n \\agoalofalife\\bpm\\ServiceProviders\\BpmBaseServiceProvider::class\n```\n \n Далее можно пользоваться извлекая обьект из контейнера \n \n \n    $bpm =  app('bpm');\n    $bpm-\u003esetCollection('CaseCollection');\n\n     $handler = $bpm-\u003eaction('read:xml', function ($read){\n        $read-\u003eamount(1);\n    })-\u003eget();\n \n \n Либо используя фасад , предварительно зарегистрировав его в файле `config/app.php`:\n \n```\n   'aliases' =\u003e [\n Illuminate\\Support\\Facades\\Facade\\Bpm\n  ... \n  ]\n```\n\n\n  Клиентский код\n\n```\n\n    Bpm::setCollection('CaseCollection');\n     $handler = Bpm::action('read:xml', function ($read){\n        $read-\u003eamount(1);\n    })-\u003eget();\n```\n\n\u003ca name=\"Tools\"\u003e\u003c/a\u003e\n## Инструмент\n\nВам необходимо запустить сервер выполнив команду\n\n```\nvendor/bin/panel-server\n```\nКогда перейдете по адресу то увидите перед собой , статистику продолжительности ваших запросов в Bpm.\nЭто программа парсит ваш лог файл который находиться по адресу src/resource/logs\n\n![alt text](http://g.recordit.co/n5sFQxDnIr.gif)\n\n \u003ca name=\"EN\"\u003e\u003c/a\u003e\n\n\n**What is it ?**\n\nThe package provides a convenient interface to work with [API Bpm’online](https://academy.terrasoft.ru/documents/technic-sdk/7-8/rabota-s-obektami-bpmonline-po-protokolu-odata-s-ispolzovaniem-http-zaprosov) through the Protocol\n\n- [Install](#Installation_en)\n- [Configurations](#Config_en)\n- [Authentication](#Authentication_en)\n- [Set Collection](#SetCollection_en)\n- [Base Request](#BasesRequest_en)\n    - [Select](#Select_en)\n    - [Create](#Create_en)\n    - [Update](#Update_en)\n    - [Delete](#Delete_en)\n- [Handler Response](#Handler_en)\n- [Log](#Log_en)\n- [Integration with Laravel](#Laravel_en)\n- [Tool](#Tool_en)\n\n\u003ca name=\"Installation_en\"\u003e\u003c/a\u003e\n## Install\n\nFor installation, you must run the command from composer\n\n    \n    composer require agoalofalife/bpm-online\n\u003ca name=\"Config_en\"\u003e\u003c/a\u003e\n\n## Configurations\n\nTo install your configuration data there are several ways :\n\n - class File\n \n```\n //Init  kernel\n $kernel = new KernelBpm();\n $file = new File();\n \n // specify the path to the file with the configurations\n $file-\u003esetSource(__DIR__ . '/config/apiBpm.php');\n // loading...\n $kernel-\u003eloadConfiguration($file);\n```\n\n\nThe file must return an array with the data\n```\nreturn [\n\t// url for auth\n    'UrlLogin' =\u003e '',\n    //our url for request api       \n    'UrlHome'  =\u003e '',\n    'Login'    =\u003e '',\n    'Password' =\u003e ''\n    ]\n```\n\n\n - through method setConfigManually in KernelBpm\n\n```\n$kernel = new KernelBpm();\n// the first parameter is passed a prefix for configuration\n$kernel-\u003esetConfigManually('apiBpm', [\n        'UrlLogin' =\u003e '',\n        'Login'    =\u003e '',\n        'Password' =\u003e '',\n        'UrlHome'  =\u003e ''\n]);\n```\n\n\n\u003ca name=\"Authentication_en\"\u003e\u003c/a\u003e\n## Authentication\n\nFor authentication in BPM API , it is necessary to get cookie in URL\n\n`https://ikratkoe.bpmonline.com/ServiceModel/AuthService.svc/Login`\nIt is necessary to call the method `authentication`\n\n\n```\n$kernel-\u003eauthentication();\n```\n\nYou can not call it and the package will automatically update the cookies by making an additional query.\n\n\u003ca name=\"SetCollection_en\"\u003e\u003c/a\u003e\n\n## Set Collection\n\nIn **BPM**  all tables of the database are referred to as collections  ( Collections )\nTo communicate, you must install the collection.\n\n```\n$kernel-\u003esetCollection('CaseCollection');\n```\n\nThis approach has an additional disadvantage in the method call `setCollection`,  but reuse installation of the collection.\nMeaning that we can install a collection and perform operations on it.\n\n\u003ca name=\"BasesRequest_en\"\u003e\u003c/a\u003e\n\n\u003ca name=\"Select_en\"\u003e\u003c/a\u003e\n\n\n## Select\n\nAll methods take the first parameter of the string type and the data type, \nthe second parameter `callback`  inside of which is passed the type of operation, inside `callback`  executed all pre - settings at the end method is called `get`.\n\nReturns the object type Handler which handler response from BPM.\n\n```\n$handler = $kernel-\u003eaction('read:json', function ($read){\n    $read-\u003eamount(1)-\u003eskip(100);\n\n})-\u003eget();\n\n```\n\nOnly two types of data `xml` and `json`.\nFour types of operations `read`, `create`, `update`, `delete`.\n\n**Methods Select**\n\n**filterConstructor** \n\nAllows you to filter the selection using the function $filter  in request\n```\nfilterConstructor('Id eq guid\\'00000000-0000-0000-0000-000000000000\\'');\n```\n\n**orderBy** \nTo retrieve data in sorted form\nThe first parameter the field name, the second argument to sort :\nascending (asc)\ndescending (desc)\n```\n-\u003eorderby('Number', 'desc')\n```\n\n**skip** \n\nIf you want to skip the specified number of records\n\n```\n-\u003eskip(10)\n```\n\n**amount**\nTo set the maximum number of records\n\n```\n-\u003eamount(100)\n```\n`Keep in mind that you can combine the methods according to the documentation\nBpm’online`\n\n\u003ca name=\"Create_en\"\u003e\u003c/a\u003e\n## Create\n\nThe syntax for creating a record is the same as Select.\nInside  `callback` you must call setData and  pass his array parameters for creating record in  table BPM.\n\n```\n$handler = $kernel-\u003eaction('create:xml', function ($creator){\n    $creator-\u003esetData([\n        // array key =\u003e value\n    ]);\n})-\u003eget();\n```\n\u003ca name=\"Update_en\"\u003e\u003c/a\u003e\n\n## Update\nTo update the data in the record BPM you need to know guid record.\nThis set guid and new  parameters for updates.\n```\n$handler = $kernel-\u003eaction('update:json', function ($creator){\n    $creator-\u003eguid('')-\u003esetData([\n       'Number' =\u003e ''\n    ]);\n})-\u003eget();\n```\n\n\u003ca name=\"Delete\"\u003e\u003c/a\u003e\n## Delete\n\nFor deleting a record from DB enough to know guid and only guid\n```\n$handler = $kernel-\u003eaction('delete:xml', function ($creator){\n    $creator-\u003eguid('');\n})-\u003eget();\n```\n\n\u003ca name=\"Handler_en\"\u003e\u003c/a\u003e\n## Handler Response\n\nRegardless of the operation always returns a typeп  Handler,  which has several methods to convert the data.\n\n**toArray**\nConverts the data into an array\n\n**toJson**\nConverts the data to json\n\n**getData**\nJust Return the data\n\n\u003ca name=\"Log_en\"\u003e\u003c/a\u003e\n## Log\n\nAt the moment, the package keeps a detail of all queries sorted by date.\nYou can find them in `src/resource/logs/...`\n\n\u003ca name=\"Laravel_en\"\u003e\u003c/a\u003e\n## Integration with Laravel\n\nFor integration with the framework Laravel you must copy the configuration and fill them\n\n```\n php artisan vendor:publish --tag=bpm --force\n```\nInsert the service provider to a file `config/app.php`\n\n```\n \\agoalofalife\\bpm\\ServiceProviders\\BpmBaseServiceProvider::class,\n```\n Then you can use extract the object from the container.\n \n```\n    $bpm =  app('bpm');\n    $bpm-\u003esetCollection('CaseCollection');\n\n     $handler = $bpm-\u003eaction('read:xml', function ($read){\n        $read-\u003eamount(1);\n    })-\u003eget();\n```\n\n \nOr by using the Facade , registering it in a file`config/app.php`:\n \n```\n   'aliases' =\u003e [\n Illuminate\\Support\\Facades\\Facade\\Bpm\n  ... \n  ]\n```\n\n  Client code\n  \n```\n    Bpm::setCollection('CaseCollection');\n     $handler = Bpm::action('read:xml', function ($read){\n        $read-\u003eamount(1);\n    })-\u003eget();\n```\n## Tool\n\u003ca name=\"Tool_en\"\u003e\u003c/a\u003e\n\nYou need to start the server by running the command :\n\n```\nvendor/bin/panel-server\n```\nWhen you click on the address you will see a statistics of the duration of your queries in Bpm.\nThis program parses your log file which is located at the address src/resource/logs\n\n![alt text](http://g.recordit.co/n5sFQxDnIr.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoalofalife%2Fbpm-online","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagoalofalife%2Fbpm-online","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagoalofalife%2Fbpm-online/lists"}