Download the PHP package merophp/framework without Composer

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

Introduction

Merophp is a mini framework for web applications. It is mainly designed as a tool for refactoring of legacy projects. This means you can integrate it and don't have to instantly do a big migration. Instead, you can do the migration over a long period of time.

It implements following standards:

It provides:

Installation

Via composer:

composer require merophp/framework

Basic Usage

use Merophp\Framework\AppFactory;
use Merophp\Router\Routes\GetRoute;

require_once dirname(__DIR__).'/vendor/autoload.php';

//Create the app object
$app = AppFactory::create();

//Add routes to the router
$app->getRouter()->addRoutes(
    new GetRoute('/hello-world', function($request, $response){
        $response->getBody()->write('Hello World');
        return $response;
    })
);

//Run Forrest, run!
$app->start();

This is all you need to create a hello world app.

The Bundle Concept

You can use bundles aka plugins to structure and flexibilize your application. Merophp comes with a bundle interface for manipulation and extending of the request handling. Bundles should be separate composer packages to use composers autoloading and dependency management. Your bundles has to provide a bootstrapper class which implements the interface Merophp\BundleManager\BundleBootstrapper\BundleBootstrapperInterface or extending the Merophp\Framework\BundleManagement\BundleBootstrapper\AbstractBundleBootstrapper class.

{your bundle path}/src/Bootstrapping/Bootstrapper.php:

namespace MyVendor\MyBundle\Bootstrapping;

use Merophp\Framework\BundleManagement\BundleBootstrapper\AbstractBundleBootstrapper;
use Merophp\Router\Routes\GetRoute;

class Bootstrapper extends AbstractBundleBootstrapper
{
    public function setup(){
        $this->app->getRouter()->addRoutes(
            new GetRoute('/hello-world', function($request, $response){
                $response->getBody()->write('Hallo World');
                return $response;
            })
        );
    }
    public function tearDown(){}
}

{your bundle path}/composer.json:

{
  "name": "my-vendor/my-bundle",
  "autoload": {
    "psr-4": {"MyVendor\\MyBundle\\": "src/"}
  },
  "require": {
    "merophp/framework":"*"
  }
}

Run: composer update

index.php:

use Merophp\Framework\AppFactory;

require_once dirname(__DIR__).'/vendor/autoload.php';

//Create the app object
$app = AppFactory::create();

//Register bundle
$app->registerBundle('MyVendor\\MyBundle');

//Run Forrest, run!
$app->start();

You can also register bundles inside the setup method of a bundles' bootstrapper.

Using Controller Classes

In most cases you do not want to add a callback function to a route and use a controller with actions instead. Merophp provides you an easy-to-use controller integration:

Adding a route:

use MyVendor\MyBundle\Controller\MyCoolController;

$this->app->getRouter()->addRoutes(
     new GetRoute('/hello/{with-name}', [MyCoolController::class, 'myAction'])
);

{your bundle path}/src/Controller/MyCoolController.php

namespace MyVendor\MyBundle\Controller;

use Merophp\Framework\RequestControlling\AbstractController;

class MyCoolController extends AbstractController
{
    /**
     * @param string $name The param from the url
     */
    public function myAction($name)
    {
        //$arguments = $this->request->getParsedBody();

        $this->view->text('Hello '.$name);
    }
}

Sending an HTTP request with url https://{your-address}/hello/Martin will give you the response 'Hello Martin'.

You also can use dependency injection inside your controller, manipulate the response object and store information in the TransactionCache for the next request of the visitor.

About

Requirements

Merophp Framework works with PHP 7.4, 8.0 and 8.1. No further PHP extensions required.

Support

Be aware, this is something like a just-for-fun project and there is no guaranty of support or further maintenance. There is also a high risk of volatility.


All versions of framework with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
psr/simple-cache Version ^1
psr/event-dispatcher Version ^1.0
merophp/router Version 0.1.*
merophp/bundle-manager Version 0.1.*
merophp/log-manager Version 0.1.*
merophp/view-engine Version 0.1.*
merophp/object-manager Version 0.1.*
merophp/singleton Version 0.1.*
merophp/text-view Version 0.1.*
shieldon/psr-http Version ^1.2
yiisoft/event-dispatcher Version ^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 merophp/framework contains the following files

Loading the files please wait ....