{"id":35178397,"url":"https://github.com/shoman4eg/moy-nalog","last_synced_at":"2026-01-21T04:04:22.495Z","repository":{"id":39644186,"uuid":"454233493","full_name":"shoman4eg/moy-nalog","owner":"shoman4eg","description":"Неофициальный php API клиент lknpd.nalog.ru (\"Мой Налог\") ","archived":false,"fork":false,"pushed_at":"2026-01-05T03:02:43.000Z","size":132,"stargazers_count":62,"open_issues_count":2,"forks_count":13,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-01-09T04:57:13.760Z","etag":null,"topics":["lknpd-nalog","moy-nalog","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/shoman4eg.png","metadata":{"files":{"readme":"README.en.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://pay.cloudtips.ru/p/2e70e850"]}},"created_at":"2022-02-01T02:02:57.000Z","updated_at":"2026-01-07T07:56:11.000Z","dependencies_parsed_at":"2025-05-21T00:38:33.937Z","dependency_job_id":null,"html_url":"https://github.com/shoman4eg/moy-nalog","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/shoman4eg/moy-nalog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoman4eg%2Fmoy-nalog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoman4eg%2Fmoy-nalog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoman4eg%2Fmoy-nalog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoman4eg%2Fmoy-nalog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shoman4eg","download_url":"https://codeload.github.com/shoman4eg/moy-nalog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shoman4eg%2Fmoy-nalog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28625926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T02:47:06.670Z","status":"ssl_error","status_checked_at":"2026-01-21T02:45:44.886Z","response_time":86,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["lknpd-nalog","moy-nalog","php"],"created_at":"2025-12-28T23:47:33.868Z","updated_at":"2026-01-21T04:04:22.490Z","avatar_url":"https://github.com/shoman4eg.png","language":"PHP","funding_links":["https://pay.cloudtips.ru/p/2e70e850"],"categories":[],"sub_categories":[],"readme":"# Unofficial MoyNalog API client\n\n[![Php version](https://img.shields.io/packagist/php-v/shoman4eg/moy-nalog?style=flat-square)](composer.json)\n[![Latest Version](https://img.shields.io/github/release/shoman4eg/moy-nalog.svg?style=flat-square)](https://github.com/shoman4eg/moy-nalog/releases)\n[![Total Downloads](https://img.shields.io/packagist/dt/shoman4eg/moy-nalog.svg?style=flat-square)](https://packagist.org/packages/shoman4eg/moy-nalog)\n[![Scrutinizer code quality](https://img.shields.io/scrutinizer/quality/g/shoman4eg/moy-nalog/master?style=flat-square)](https://scrutinizer-ci.com/g/shoman4eg/moy-nalog/?branch=master)\n[![Packagist License](https://img.shields.io/packagist/l/shoman4eg/moy-nalog?style=flat-square)](LICENSE)\n[![Donate](https://img.shields.io/badge/Donate-Tinkoff-yellow?style=flat-square)](https://www.tinkoff.ru/cf/7rZnC7N4bOO)\n\nAn unofficial wrapper client for [lknpd.nalog.ru](https://lknpd.nalog.ru/) API\n\n## Install\n\nVia Composer\n\n```bash\n$ composer require shoman4eg/moy-nalog\n```\n\nAlso you need one of packages suggests `psr/http-client-implementation`\n\nRecommends `symfony/http-client` or `guzzlehttp/guzzle`\n\n## Usage\n\n### Settings\n```php\n// If need set timezone use this\ndate_default_timezone_set('Europe/Kaliningrad');\n// or set timezone through new DateTimeZone\n$operationTime = new \\DateTimeImmutable('now', new \\DateTimeZone('Europe/Kaliningrad'))\n```\n### Authorization by INN \u0026 password\n```php\nuse Shoman4eg\\Nalog\\ApiClient;\n\n$apiClient = ApiClient::create();\n\n// If known accessToken skip this step\ntry {\n    $accessToken = $apiClient-\u003ecreateNewAccessToken($username, $password);\n} catch (\\Shoman4eg\\Nalog\\Exception\\Domain\\UnauthorizedException $e) {\n    var_dump($e-\u003egetMessage());\n}\n\n$apiClient-\u003eauthenticate($accessToken);\n```\n\n### Authorization by phone number\nAuthorization by phone number takes place in two steps.\nYou need to request authorization by phone, temporarily save the returned challenge token, receive an SMS with a confirmation code, and then pass the phone, the challenge token and the confirmation code from the SMS by a second request.\n\n**Please note:** there is a limit for sending SMS with confirmation code (one SMS every 1-2 minutes).\n\n#### 1. Send an SMS with a confirmation code to your phone number and temporarily save the challenge token:\n```php\nuse Shoman4eg\\Nalog\\ApiClient;\n\ntry {\n    $phoneChallengeResponse = ApiClient::createPhoneChallenge('79999999999');\n    /**\n     * $phoneChallengeResponse = [\n     *  'challengeToken' =\u003e '00000000-0000-0000-0000-000000000000',\n     *  'expireDate' =\u003e 2022-11-24T00:20:19.135436Z,\n     *  'expireIn' =\u003e 120,\n     *  ];\n     */\n\n} catch (\\Shoman4eg\\Nalog\\Exception\\Domain\\UnauthorizedException $e) {\n    var_dump($e-\u003egetMessage());\n}\n\n//Save $response['challengeToken'] until you get the confirmation code from the SMS. You need it for the second step.\n```\n#### 2. Exchange your phone number, challenge token and code from SMS for the access token:\n```php\nuse Shoman4eg\\Nalog\\ApiClient;\n\n$apiClient = ApiClient::create();\n\ntry {\n    $accessToken = $apiClient-\u003ecreateNewAccessTokenByPhone(\n    \t'79999999999',\n    \t'00000000-0000-0000-0000-000000000000',\n    \t'111111'\n    );\n} catch (\\Shoman4eg\\Nalog\\Exception\\Domain\\UnauthorizedException $e) {\n    var_dump($e-\u003egetMessage());\n}\n\n$apiClient-\u003eauthenticate($accessToken);\n```\n\n### Create income with default client\n```php\n$name = 'Предоставление информационных услуг #970/2495';\n$amount = 1800.30;\n$quantity = 1;\n$operationTime = new DateTimeImmutable('2020-12-31 12:12:00');\n$createdIncome = $apiClient-\u003eincome()-\u003ecreate($name, $amount, $quantity, $operationTime);\n```\n\n### Create income with multiple items\n```php\n$name = 'Предоставление информационных услуг #970/2495';\n$items = [\n    new \\Shoman4eg\\Nalog\\DTO\\IncomeServiceItem($name, $amount = 1800.30, $quantity = 1),\n    new \\Shoman4eg\\Nalog\\DTO\\IncomeServiceItem($name, $amount = 900, $quantity = 2),\n    new \\Shoman4eg\\Nalog\\DTO\\IncomeServiceItem($name, $amount = '1399.99', $quantity = 3),\n];\n$operationTime = new DateTimeImmutable('2020-12-31 12:12:00');\n$createdIncome = $apiClient-\u003eincome()-\u003ecreateMultipleItems($items, $operationTime);\n```\n\n### Create income with custom client\n```php\n$name = 'Предоставление информационных услуг #970/2495';\n$amount = 1800.30;\n$quantity = 1;\n$operationTime = new \\DateTimeImmutable('2020-12-31 12:12:00');\n\n$client = new \\Shoman4eg\\Nalog\\DTO\\IncomeClient(); // Default. All fields are empty IncomeType is FROM_INDIVIDUAL\n// or\n$client = new \\Shoman4eg\\Nalog\\DTO\\IncomeClient('+79009000000', 'Вася Пупкин', \\Shoman4eg\\Nalog\\Enum\\IncomeType::INDIVIDUAL, '390000000000');\n// or\n$client = new \\Shoman4eg\\Nalog\\DTO\\IncomeClient(null, 'Facebook Inc.', \\Shoman4eg\\Nalog\\Enum\\IncomeType::FOREIGN_AGENCY, '390000000000');\n// or\n$client = new \\Shoman4eg\\Nalog\\DTO\\IncomeClient(null, 'ИП Вася Пупкин Валерьевич', \\Shoman4eg\\Nalog\\Enum\\IncomeType::LEGAL_ENTITY, '7700000000');\n$createdIncome = $apiClient-\u003eincome()-\u003ecreate($name, $amount, $quantity, $operationTime, $client);\n```\n\n### Cancel income\n```php\n$receiptUuid = \"20hykdxbp8\"\n$comment = \\Shoman4eg\\Nalog\\Enum\\CancelCommentType::CANCEL;\n$partnerCode = null; // Default null\n$operationTime = new \\DateTimeImmutable('now'); //Default 'now'\n$requestTime = new \\DateTimeImmutable('now'); //Default 'now'\n$incomeInfo = $apiClient-\u003eincome()-\u003ecancel($receiptUuid, $comment, $operationTime, $requestTime, $partnerCode);\n```\n\n### Create Invoice\n```php\n// todo\n```\n\n### Cancel Invoice\n```php\n// todo\n```\n\n### Change payment type in Invoice\n```php\n// todo\n```\n\n### Get user info\n```php\n$userInfo = $apiClient-\u003euser()-\u003eget();\n```\n\n### Get receipt info\n```php\n// $receiptUuid = $createdincome-\u003egetApprovedReceiptUuid();\n\n// Get print url\n$receipt = $apiClient-\u003ereceipt()-\u003eprintUrl($receiptUuid);\n\n// Json data\n$receipt = $apiClient-\u003ereceipt()-\u003ejson($receiptUuid);\n```\n\n## References\n[Автоматизация для самозанятых: как интегрировать налог с IT проектом](https://habr.com/ru/post/436656/)\n\nJS lib [alexstep/moy-nalog](https://github.com/alexstep/moy-nalog)\n\n## Changelog\n[Changelog](CHANGELOG.md): A complete changelog\n\n## Donation\nIf this project help you reduce time to develop, you can give me a cup of coffee :)\n\n[Link to donate](https://www.tinkoff.ru/cf/7rZnC7N4bOO)\n\n## License\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoman4eg%2Fmoy-nalog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshoman4eg%2Fmoy-nalog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshoman4eg%2Fmoy-nalog/lists"}