Download the PHP package sinri/clover without Composer

On this page you can find all versions of the php package sinri/clover. 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 clover

Clover

An MVC Framework for Restful Web Project in PHP, under MIT License, now version 0.2.

Introduction

Clover is designed after CodeIgniter but much more simpler. It provides Restful style HTTP request process resolution.

Clover uses Model-View-Controller (MVC) architecture. Clover would parse all requests to controller, method and its parameters, and call the very method of controller with those parameters to response.

In short, URL clover.ng/CONTROLLER/METHOD/Param1/Param2 would be processed by CONTROLLER()->METHOD(Param1,Param2). Of course, URL clover.ng/CONTROLLER/METHOD/Param1, clover.ng/CONTROLLER/METHOD, and clover.ng/CONTROLLER are also available if controller was designed to support.

For GET request, Clover would parse the query string. For POST, Clover accept encoded url data and form data format by default, and also request with JSON data as HTTP request body when declare application/json as the value of Header Content-Type.

Install

Clover is based on rewrite modual of Apache. (Nginx is also supported, in theory.) Create and edit .htaccess file in the root directory with the following:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
# For Apache2

Usage

Clover supports processing web requests. As well, Clover could be used in CLI mode since version 0.2, as Yii Framework supports.

Just fill the controller classes in controller directory, model classes in model directory, and view html files in view directory. For command line use, fill commands in command directory.

Import Clover file into index.php for web request, or CloverCLI.php for CLI:

require __DIR__.'/core/Clover.php';

In index.php, first set the root path:

Clover::setRootPath($path_of_root);

For some strange purposes, Clover supports customization on MVC directories, just modify the source code under MIT License.

Finally, start Clover:

Clover::start();

Controller

Create an php file with a class inside. File name should be the same with the class inside. The class should extend class CloverController.

The methods of the class would be the method of the controller and index would be the default. The third element and the next ones of the url, if exist, would be the parameters of the method.

Use method display($view_file,$assignment=array(),$isPart=false) to display with certain view. The second parameter is an array to carry the assigned parameters to view. For example, if pass array('K'=>'V') as $assignment, you can use ` to displayV` in your response view. The third parameter accepts boolean value and FALSE by default to stop PHP script with this very function call. If TRUE were given, the PHP script would run continuely until the end of the code.

Model

You can define model class in model directory in the php file with same name, which would be loaded automatically when called.

View

For view, create html file in view directory. Within the html content, you can use PHP codes inside, as well as the assigned parameters.

Command

Create an php file with a class inside. File name should be the same with the class inside. The class should extend class CloverCommand.

The methods of the class which named as .+Action would be treated as action to execute, and default as defaultAction. For parameter usage, use --PARAM_NAME=PARAM_VALUE.

You can override beforeAction and afterAction functions to realize the action procedure control.

Clover Class Toolkits

The following are all static functions of Clover class.

Get Query Method

function getQuery($name=null,$default=null)

Return the whole $_GET when $name is null. When $name is not null, try to return $_GET[$name] if it is set, or $default would be returned.

Get Raw HTTP Request Method

function getRawRequestBody()

Return the raw body of the current HTTP request.

Get Data Method

function getData($name=null,$default=null)

If request comes in standard HTTP format, return the whole $_POST when $name is null. When $name is not null, try to return $_POST[$name] if it is set, or $default would be returned.

If request comes in JSON Object format and application/json delared in Content-Type header, Clover would parse the HTTP request to JSON Object and get its property with the name given, or return $default when not set.

P.S.

I think that, CI is in good design, but it is too heavy for simple project. I want make an environment to work with free feel, from both requirements and frameworks. In short, I do not want to learn too much about a tool and then trap into the tool. Using Clover, you can get the nearly same result with CI, but you can use all pure PHP function instead of the completely capsulized toolkit of CI. You like extension? Well, just develop them as you like. Clover is only a base framework.


All versions of clover with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.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 sinri/clover contains the following files

Loading the files please wait ....