Skip to content

cothema/math-php-api

Repository files navigation

Cothema PHP Math API

Integrity check Codecov License: MIT PHPStan Enabled

This package is REST API for Math requests.

We provide a third-party REST API wrapper for Mathematicator Search engine based on Mathematicator Framework.

This package has 2 main ways how to use it:

  • Install it on your server
  • Use our hosted Cloud API service

You can call the API in these ways:

  • Build your own frontend (e.g. in React or Angular) that calls this REST API
  • Call the API from your backend services

REST API Documentation

Endpoints

Method URL Description
GET /v1/search/?q=:query Solves query and returns response
GET /v1/ping Returns actual server time

Usage

Cloud: our public API (recommended)

The easiest way to use is to use our public API.

Terms of service: https://cothema.com/terms

Public API: https://math-php.herokuapp.com/

Pricing

Our cloud API is temporarily free of charge.

Hosted solution

You can also download the source code of this repository and run it on your own server or e.g. cloud service.

Development

This package is based on:

Via Docker (Recommended)

Start project:

docker-compose -f docker/docker-compose.dev.yml up -d

Without Docker

Start project:

composer install
symfony server:start

Run tests:

php vendor/bin/codecept run

Contributions

Feel free create new issues and send pull requests. All pull requests should contain complete unit tests.

We follow standards: PSR-1, PSR-4, PSR-12

We recommend to use PHPStorm IDE.

Dev notes

This project is determined for end usage as REST API, so we tend to use only the latest package versions.

Rest API should be infinitely back-compatible for its major version.

Project responsibility

This repository can/should contain:

  • Thin API layer as a proxy for query solver repositories.
  • API restrictions / limits (not implemented)
  • API authentication (not implemented)
  • API billing logic (not implemented)
  • Store data in a database

This repository should NOT contain:

  • Query tokenization
  • Query solution logic (e.g. calculations)

Mathematicator Framework tools structure

⚠️ Warning: Mathematicator Framework is a third-party toolset, so we do not guarantee its functionality if you will not use our API package.

The biggest advantage is that you can choose which layer best fits your needs and start build on the top of it, immediately, without the need to create everything by yourself. Our tools are tested for bugs and tuned for performance, so you can save a significant amount of your time, money, and effort.

Framework tend to be modular as much as possible, so you should be able to create an extension on each layer and its sublayers.

Mathematicator framework layers ordered from the most concrete one to the most abstract one:

Search Modular search engine layer that calls its sublayers and creates user interface.
Vizualizator Elegant graphic visualizer that can render to SVG, PNG, JPG and Base64.
Extensions: Mandelbrot set generator
Calculator Modular advance calculations layer.
Extensions: Integral Solver , Statistics
Engine Core logic layer that maintains basic controllers, DAOs, translator, common exceptions, routing etc.
Tokenizer Tokenizer that can convert string (user input / LaTeX) to numbers and operators.
Numbers Fast & secure storage for numbers with arbitrary precision. It supports Human string and LaTeX output and basic conversions.

About

Rest API for math engine written in PHP.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published