Download the PHP package misterspelik/rpn-calculator without Composer

On this page you can find all versions of the php package misterspelik/rpn-calculator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package rpn-calculator

Reverse Polish Notation Calculator

This is PHP implementation of RPN Calculator.

Solution description

Package consists of several classes and was designed for future usage as Composer package. Concept is having Rpn\Calculator class which is Singleton designed in order to be the same instance in possibly different parts of Application which uses it. It injects dependencies such as:

Also these is separate Rpn\Cli class in order to be used as part of CLI Application.

Installation

Since this planned to be used via composer please clone this repository and run

CLI RPN Calculator - Usage

In order to use CLI mode please use index.php file. There is a wrapper for some cases as decribed below.

Use cases

  1. Using with optional --expression parameter. In this case application calculates result and gives it as output. Exit code is 0.

  2. Using as step-by-step calculator. Runs as

And then incrementally giving operands and operators

Available commands in step-by-step mode

ToDo

As far as this is quick solution it is not well structured. Hope this will be fixed in future. Items described below need to be added for package to be finished. Obviously need more time to finish that and hope this could be done in future. Or you are welcome to fork and add :)

Exceptions

For now Rpn\Validator just echoes messages if something is wrong. For sure this is hard-code and needs to be refactored to throw exceptions Possible location of Exceptions classes could be used as src/Exceptions under Rpn\Exceptions namespace.

Under this item I assume that throw and catch (in client code) needs to be added in order to correct work.

Tests

This Calculator could be automatically tested by phpUnit and btw that was also one of reasons to add composer.json. In future require-dev section can be added with phpunit.

Add more operations

As far as only 4 basic operations are supported it would be great to add more operations, possibly all :)


All versions of rpn-calculator with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package misterspelik/rpn-calculator contains the following files

Loading the files please wait ....