Download the PHP package piano/mvc without Composer

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

Build Status

Piano MVC

This is not a micro/mini/whatever framework nor claims to be.

It's only a very simple MVC structure.

WARNING: This has been just like a lab. I don't update this project anymore. If you want to use it, the ball is on your court.

Creating the project structure

Controller

Redirecting

Redirecting with variables

Getting params by name

Getting all params

Methods from Piano\Mvc\Controller

initialize()

If you need to create a constructor method for your controller, you can do this by creating a method called initialize() instead of __construct(). The __construct() method is already being used by Piano\Mvc\Controller.

Example:

View

Rendering a view

Rendering a view with variables

So, in the view code you can access the variable:

Disabling/Enabling the layout

Adding a partial

Adding a partial with variables

Loading CSS files

You can load CSS files on demand. It means you can define what CSS files are gonna be loaded when some specific view is rendered. Better than that, you can do this for each of your views.

You can use the addCss() method.

Or you may want to use the setCss() method.

PS: You must call addCss() or setCss() method before calling the render() method. Otherwise it won't work.

Loading javascript files

You can load javascript files on demand. It means you can define what javascript files are gonna be loaded when some specific view is rendered. Better than that, you can do this for each of your views.

You can use the addJs() method.

Or you may want to use the setJs() method.

PS: You must call addJs() or setJs() method before calling the render() method. Otherwise it won't work.

In order to load these CSS or JS files in your view/layout you can call the loadCss() or loadJs() method.

href links

Form action must be written by using a pre-defined route

Model

The DataAccessAbstract class.

The Piano\Mvc\DataAccessAbstract abstract class provides us a few methods for handling data by accessing the database.

Attributes from Piano\Mvc\DataAccessAbstract

Table name for working.

If not null, it's used for fetching its model. Otherwise, it will use an associative array.

A PHP PDO instance.


Methods from Piano\Mvc\DataAccessAbstract

Create a record into database.

Parameters

data

Array data to insert into the database table.

dataBind

The bound values.

Return Values

Returns the last insert id on success or FALSE on failure.


Change a database record.

Parameters

data

Array data to insert into the database table.

where

Where clause.

dataBind

The bound values.

Return Values

Returns TRUE on success or FALSE on failure.


Delete a record from database.

Parameters

where

Where clause.

dataBind

The bound values.

Return Values

Returns TRUE on success or FALSE on failure.


Perform a query in order to return all database records.

Parameters

configData

The query configuration.

Example:

order

Like SQL ORDER.

Example:

count

Integer value used to make the query return a specific set of rows.

offset

Integer value used to make the query return a specific set of rows.

PS: When both count and offset are used, the query to be executed has LIMIT offset, count

Return Values

  • When fetchClass parameter is true or omitted, it returns an array of model objects.
  • When fetchClass parameter is false, it returns an associative array.

Perform a query in order to return all database records.

Parameters

configData

The query configuration.

Example:

order

Like SQL ORDER.

Example:

Return Values

  • When fetchClass parameter is true or omitted, it returns a model object.
  • When fetchClass parameter is false, it returns an associative array.

Examples:

insert()
update()
delete()
getAll()
getFirst()

Application

Getting module name

Getting controller name

Getting action name


Class Piano\Config\Ini

The Piano\Config\Ini is a ini file parser. You must pass the ini path as an argument to its constructor.

Sample

Class Piano\Config\Pdo

The Piano\Config\Pdo provide us an easier way to configure a \Pdo connection. You must pass an config array as an argument to its constructor.

Sample

Class Piano\Router

The Piano\Router is a route parser. It helps you to define the application's routes.

Sample

You're able to define all routes as an array or by using the Piano\Router object notation.

Defining routes as array.

Defining routes as object.

You can also enable/disable SEF. (It's useful to disable it when developing) It can be done by calling the method enableSearchEngineFriendly

If you want to get all routes or a particular one, you could do like this:


All versions of mvc with dependencies

PHP Build Version
Package Version
No informations.
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 piano/mvc contains the following files

Loading the files please wait ....