GithubHelp home page GithubHelp logo

syngr's Introduction

Syngr Build Status Coverage Status

Syngr : SYNtactic suGaR

This project is an effort to consolidate PHP's wildly varying functions, and provide some sort of Standard Library for it.

Usage

The idea is to make programming in PHP simpler, and force it to behave in a more predictable manner. Most, if not all, methods for these types all operate on the object itself, which gives us a nice side-benefit of being able to chain multiple methods on an object.

String methods

$string = new String('hello world');
echo $string->uppercase()       // HELLO WORLD
            ->substring(0, 6)   // HELLO
            ->replace(' ', '?') // HELLO?
            ->trim('?');        // HELLO

Array conversion

join()
split()

Comparison

compare() // Change to match() after implementing preg_match()

Encoding

Hashing

hash()

HTML

Searching

String Formatting

Substring

substring()

Text Formatting

trim()
uppercase()
lowercase()
pad()
length()
reverse()
replace()

Number methods

$number = new Number(6.9);
echo $number->ceiling()              // 7
            ->max(array(5, 9, 49.1)) // 49.1
            ->floor()                // 49
            ->sqrt()                 // Value
            ->value();               // Get raw value rather than string

Algebraic functions

absolute()
ceiling()
floor()
round()
max()
min()
sqrt()

Conversions

convert()

Random

random()

Transcendental functions

exp()
log()
pow()

Trigonometric

cos()
sin()
tan()

Project Setup

Clone the project somewhere, cd to the directory and type in composer install.

Syngr's dependencies are listed in the composer.json file, but if you're installing as a user then it has no extra dependencies (whoop!).

The best way to see Syngr in action is to look at the test code // Add an examples folder.

Testing

Unit Tests

Run phpunit from the terminal in the project folder to run unit tests.

Integration Tests

  1. Run other local services / provide credentials for external services.
  2. rake spec:integration

Documentation

From the project folder, type in php vendor/bin/sami.php update gen-docs.php. The documentation will be generated in a folder called 'docs'.

Troubleshooting & Useful Tools

Examples of common tasks

e.g.

  • How to make curl requests while authenticated via oauth.
  • How to monitor background jobs.
  • How to run the app through a proxy.

Contributing changes

  • Internal git workflow
  • Pull request guidelines
  • Tracker project
  • Google group
  • irc channel
  • "Please open github issues"

License

This project is licensed under the MIT License.

syngr's People

Contributors

hassankhan avatar alexanderc avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

trieg

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.