{"id":22296760,"url":"https://github.com/webklex/calmag","last_synced_at":"2025-10-26T05:10:18.438Z","repository":{"id":262155222,"uuid":"886377647","full_name":"Webklex/calmag","owner":"Webklex","description":"A simple calculator to calculate the optimal calcium and magnesium concentration for your nutrient solutions.","archived":false,"fork":false,"pushed_at":"2025-08-28T21:40:37.000Z","size":1273,"stargazers_count":6,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-29T02:52:04.177Z","etag":null,"topics":[],"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/Webklex.png","metadata":{"files":{"readme":"README.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},"funding":{"ko_fi":"webklex","custom":["https://www.buymeacoffee.com/webklex"]}},"created_at":"2024-11-10T20:51:40.000Z","updated_at":"2025-08-28T21:39:39.000Z","dependencies_parsed_at":"2024-11-10T22:00:14.550Z","dependency_job_id":"05daf15e-2d21-49d2-bfeb-29eb5bfa75b6","html_url":"https://github.com/Webklex/calmag","commit_stats":null,"previous_names":["webklex/calmag"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/Webklex/calmag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fcalmag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fcalmag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fcalmag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fcalmag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Webklex","download_url":"https://codeload.github.com/Webklex/calmag/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Webklex%2Fcalmag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281059632,"owners_count":26437061,"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","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"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":[],"created_at":"2024-12-03T17:47:30.076Z","updated_at":"2025-10-26T05:10:18.423Z","avatar_url":"https://github.com/Webklex.png","language":"PHP","funding_links":["https://ko-fi.com/webklex","https://www.buymeacoffee.com/webklex"],"categories":[],"sub_categories":[],"readme":"# CalMag Calculator\nA simple calculator to calculate the optimal calcium and magnesium concentration for your nutrient solutions. You can find\na demo of the calculator [here](https://www.calmag.eu/).\n\n[![Releases][ico-release]](https://github.com/Webklex/calmag/releases)\n[![Demo][ico-website-status]](https://www.calmag.eu/)\n[![License][ico-license]](LICENSE.md)\n[![Hits][ico-hits]][link-hits]\n\n\n![calmag_web_gui](https://raw.githubusercontent.com/webklex/calmag/master/calmag_web_gui.png)\n\n## Table of Contents\n- [Installation](#installation)\n    - [Requirements](#requirements)\n- [Docker](#docker)\n- [Configuration](#configuration)\n    - [Additives](#additives)\n    - [Fertilizers](#fertilizers)\n    - [Languages](#languages)\n- [API](#api)\n    - [Endpoints](#endpoints)\n    - [Request Format](#request-format)\n    - [Response Format](#response-format)\n    - [Examples](#examples)\n- [Build \u0026 Development](#build)\n- [Support](#support)\n- [Security](#security)\n- [Credits](#credits)\n- [License](#license)\n\n## Installation\n1.) Clone the repository:\n```shell script\ngit clone https://github.com/webklex/calmag.git\n```\n\n2.) Install the dependencies:\n```shell script\ncomposer install\n```\n\n3.) Start the development server:\n```shell script\nphp -S localhost:8000 -t public\n```\n\n### Requirements\n- PHP \u003e= 8.1\n- Composer\n\n## Docker\nYou can run the app using Docker for a quick and isolated setup:\n\n### Build system architecture\n```bash\ndocker buildx build -t webklex-calmag:dev .\ndocker run -d -p 8000:8000 --name webklex-calmag webklex-calmag:dev\n```\n\n### Build AMD64 architecture\nAMD64 (works in general but emulating on ARM)\n```bash\ndocker buildx build --platform linux/amd64 -t webklex-calmag:dev-amd64 .\n```\n\n### Build ARM64 architecture\n```bash\ndocker buildx build --platform linux/arm64 -t webklex-calmag:dev-arm64 .\n```\n\nA precompiled image maintained by @manfredsteger can be found here: https://hub.docker.com/r/manfredsteger/webklex-calmag\n\n\n## Configuration\nAll configuration files are located in the `src/config` directory.\n\n### Additives\nThe `src/config/additives.php` file contains all available additives. You can add new additives or modify existing ones. Make sure to keep the array structure.\n\n### Fertilizers\nThe `src/config/fertilizers.php` file contains all available fertilizers. You can add new fertilizers or modify existing ones. Make sure to keep the array structure.\n\n### Languages\nAll language files are located in the `resources/lang` directory. You can add new languages or modify existing ones. Make sure to keep structure and naming conventions - misinterpretation can lead to unexpected behavior.\nThe user specific language is determined by the `Accept-Language` header. If the language is not available, the default language will be used.\n\n## API\nThe CalMag Calculator provides a JSON API that allows you to programmatically access the calculator's functionality.\n\n### Endpoints\nThe API provides the following endpoints:\n\n- `POST`|`GET` **/** - Calculate nutrient solutions based on provided parameters\n- `GET` **/?method=additives** - Get a list of available additives\n- `GET` **/?method=fertilizers** - Get a list of available fertilizers\n- `GET` **/?method=models** - Get a list of available models\n\n### Request Format\nThe API accepts both GET and POST requests. For POST requests, the data should be sent as JSON in the request body. For GET requests, parameters can be passed in the URL query string or as a base64-encoded JSON payload in the `p` parameter.\n\nTo specify that you want a JSON response, set the `Accept` or `Content-Type` header to `application/json`.\n\n### Response Format\nAll API responses are in JSON format and include a `version` field with the current application version.\n\n#### / Response\n```json\n{\n  \"version\": \"3.4.0\",\n  \"result\": {\n    ...\n  }\n}\n```\n\n#### /?method=additives Response\n```json\n{\n  \"version\": \"3.4.0\",\n  \"additives\": {\n    \"calcium\": {\n      \"CaNO3\": {\n        \"elements\": {\n          \"calcium\": 24.43,\n          \"nitrogen\": 17.08,\n          \"magnesium\": 0\n        },\n        \"concentration\": 10,\n        \"real\": {\n          \"calcium\": 24.430000000000003,\n          \"magnesium\": 0,\n          \"nitrogen\": 17.08\n        },\n        \"name\": \"Calcium nitrate\"\n      }\n    },\n    \"magnesium\": {\n      \"MgSO4-7H20\": {\n        \"elements\": {\n          \"magnesium\": 9.86,\n          \"sulfur\": 13.01,\n          \"calcium\": 0\n        },\n        \"concentration\": 10,\n        \"real\": {\n          \"calcium\": 0,\n          \"magnesium\": 9.86,\n          \"sulfur\": 13.01\n        },\n        \"name\": \"Epsom salt - Magnesiumsulfate-Heptahydrate\"\n      }\n    }\n  }\n}\n```\n\n#### /?method=fertilizers Response\n```json\n{\n  \"version\": \"3.4.0\",\n  \"fertilizers\": {\n    \"Canna - CalMag Agent\": {\n      \"name\": \"CalMag Agent\",\n      \"elements\": {\n        \"calcium\": 7.0447999999999995,\n        \"magnesium\": 2.1386,\n        \"nitrogen\": 4.12624\n      },\n      \"density\": 1.258,\n      \"ph\": 7,\n      \"schedule\": false,\n      \"link\": {\n        \"de\": \"https://www.canna-de.com/calmag-agent\",\n        \"us\": \"https://www.canna-uk.com/calmag-agent\"\n      },\n      \"brand\": \"Canna\",\n      \"ratio\": 3.2941176470588234\n    },\n    \"BioBizz - CalMag\": {\n      \"name\": \"CalMag\",\n      \"elements\": {\n        \"calcium\": {\n          \"CaO\": 4.5654\n        },\n        \"magnesium\": {\n          \"MgO\": 1.8478999999999999\n        }\n      },\n      \"density\": 1.087,\n      \"ph\": 7,\n      \"schedule\": false,\n      \"link\": {\n        \"de\": \"https://www.biobizz.com/de/producto/calmag/\",\n        \"us\": \"https://www.biobizz.com/producto/calmag/\"\n      },\n      \"brand\": \"BioBizz\",\n      \"ratio\": 2.9256319238570767\n    }\n  }\n}\n```\n\n### Examples\n\n#### Example 1: Get available fertilizers\n```bash\ncurl -H \"Accept: application/json\" \"https://www.calmag.eu/?method=fertilizers\"\n```\n\n#### Example 2: Calculate nutrient solution (GET with encoded payload)\n```bash\n# Base64-encoded JSON payload\ncurl -H \"Accept: application/json\" \"https://www.calmag.eu/?expert=1\u0026p=eyJmZXJ0aWxpemVyIjoiIiwiYWRkaXRpdmUiOnsiY2FsY2l1bSI6IkNhTk8zIiwibWFnbmVzaXVtIjoiQ2FubmEgTW9ubyBNYWduZXNpdW0ifSwiYWRkaXRpdmVfY29uY2VudHJhdGlvbiI6eyJjYWxjaXVtIjoxMCwibWFnbmVzaXVtIjoxMDB9LCJhZGRpdGl2ZV91bml0cyI6eyJjYWxjaXVtIjoibWwiLCJtYWduZXNpdW0iOiJtbCJ9LCJlbGVtZW50cyI6eyJjYWxjaXVtIjowLCJtYWduZXNpdW0iOjAsInBvdGFzc2l1bSI6MCwiaXJvbiI6MCwic3VscGhhdGUiOjAsIm5pdHJhdGUiOjAsIm5pdHJpdGUiOjAsIm5pdHJvZ2VuIjowLCJzdWxmdXIiOjAsImNobG9yaWRlIjowfSwiZWxlbWVudF91bml0cyI6eyJjYWxjaXVtIjoibWciLCJtYWduZXNpdW0iOiJtZyIsInBvdGFzc2l1bSI6Im1nIiwiaXJvbiI6Im1nIiwic3VscGhhdGUiOiJtZyIsIm5pdHJhdGUiOiJtZyIsIm5pdHJpdGUiOiJtZyJ9LCJyYXRpbyI6My41LCJ2ZXJzaW9uIjoiMy40LjAiLCJyZWdpb24iOiJ1cyIsInZvbHVtZSI6NSwidGFyZ2V0X21vZGVsIjoibGluZWFyIiwic3VwcG9ydF9kaWx1dGlvbiI6dHJ1ZSwidGFyZ2V0X29mZnNldCI6MCwiYWRkaXRpdmVfZWxlbWVudHMiOnsiY2FsY2l1bSI6eyJjYWxjaXVtIjp7ImNhbGNpdW0iOjI0LjQzLCJDYU8iOjB9fSwibWFnbmVzaXVtIjp7Im1hZ25lc2l1bSI6eyJtYWduZXNpdW0iOjAsIk1nTyI6N319fSwiZmVydGlsaXplcl9lbGVtZW50cyI6eyJjYWxjaXVtIjp7ImNhbGNpdW0iOiIwLjAwMDAiLCJDYU8iOiIwIn0sIm1hZ25lc2l1bSI6eyJtYWduZXNpdW0iOiIwLjAwMDAiLCJNZ08iOiIwIn19LCJ0YXJnZXRfd2Vla3MiOltdLCJ0YXJnZXRfY2FsY2l1bSI6eyIxIjo2MCwiMiI6NjYuODUsIjMiOjczLjM3LCI0Ijo4MCwiNSI6ODUuMTEsIjYiOjkwLjAxLCI3Ijo5NC45LCI4IjoxMDAsIjkiOjEwNy42MiwiMTAiOjExNS4xMiwiMTEiOjEyMi42MiwiMTIiOjEzMH0sInRhcmdldF9tYWduZXNpdW0iOnsiMSI6MCwiMiI6MCwiMyI6MCwiNCI6MCwiNSI6MCwiNiI6MCwiNyI6MCwiOCI6MCwiOSI6MCwiMTAiOjAsIjExIjowLCIxMiI6MH19\"\n```\n\n## Build\nTo build the project you can use the following command:\n```shell script\nnpm install\n\nnpm run production\nnpm run build:tailwind\nnpm run watch:tailwind\n```\n\n## Support\nIf you encounter any problems or if you find a bug, please don't hesitate to create a new [issue](https://github.com/webklex/calmag/issues).\nHowever, please be aware that it might take some time to get an answer.\n\nIf you need **immediate** or **commercial** support, feel free to send me a mail at github@webklex.com.\n\n## Change log\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Security\n\nIf you discover any security related issues, please email github@webklex.com instead of using the issue tracker.\n\n## Credits\n- Fumu \u003c3\n- [Webklex][link-author]\n- [All Contributors][link-contributors]\n\n## License\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-release]: https://img.shields.io/github/v/release/webklex/calmag?style=flat-square\n[ico-downloads]: https://img.shields.io/github/downloads/webklex/calmag/total?style=flat-square\n[ico-website-status]: https://img.shields.io/website?down_message=Offline\u0026label=Demo\u0026style=flat-square\u0026up_message=Online\u0026url=https%3A%2F%2Fwww.calmag.eu%2F\n[ico-hits]: https://hits.webklex.com/svg/webklex/calmag?1\n\n[link-hits]: https://hits.webklex.com\n[link-author]: https://github.com/webklex\n[link-contributors]: https://github.com/webklex/calmag/graphs/contributors\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Fcalmag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebklex%2Fcalmag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebklex%2Fcalmag/lists"}