Download the PHP package armor/framework without Composer

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

armor-lib (x.y.z)

Latest Stable Version Build Status Armor Health Minimum PHP Version Support Latest Dev Version Packagist Downloads License

Armor (A Routing and MORe Things Framework) aims to be an useful routing framework for PHP developers.

It implements classes and methods to handle requests and respond them. And besides this, it can even receive extensions, or the famous "plugins", whatever you like to call it.

Below, you can get started on how to install it, how to use it to handle requests and, for now, how to create templates and send them as response, by using the extension library, ArmorUI.

Getting Started

Installing Armor

This step is very simple: just use Composer!

Implemeting Armor

First of all, when creating an application that uses Armor, you have to create an application instance:

Note: Optionally, you can pass a text encoder as an argument, which will be used up front to encode the response content. By default, it uses the utf8_encode.

And at the bottom of the main file, put the call to the Application#run method:

So, the file should be something like that:

Note: you should create the file .htaccess to redirect all requests to the main (index.php) file

Now, when talking about handling the requests properly, we must say that Armor offers a simple and easy way to handle a request, based on the method that has been used to perform it:

At the moment, Armor only handles GET and POST requests. But, in the future, it may support more.

The callback that is passed as argument must receive at least two parameters: a Request object and a Response object.

The Request object provides information about the path requested, the search-query parameters, and the route parameters. The last name may not sound familiar, but if you are a back-end developer, you might have seen something like this:

And the Response object provides a lot of methods for appending content to the response.

Below, you can see a small example of handling a request and sending a response:

As you can see, we are handling a request to the path /. We append a simple message to the response, which uses the absolute value of the path property of the Request object. And, finally, we complete the response, and returns it final result. That "return" is used by Armor to know if the response has been correctly built, or something unexpected has occurred. If it does, Armor throws a ResponseNotCorrectlyCompletedException.

Well, there is a lot to know about Armor. In the future, it may be fully covered by a more detailed documentation.

A little talk about using templates

There is an extension library that can be used to create some UI, called ArmorUI. For now, it provides two classes: TemplateManager, which is responsible for loading templates from their directories, and Template, which is the template object itself. It works like that:

Here, we loaded two templates: "header.templ.armor" and "index.templ.armor". They are on the same directory that the source file is. We load the manager from the inside of the closure, and use it to load the index template (getTemplate) and to send it. For sending the template, we pass the Response object by reference to the Template#sendAsResponse method. And then, we finish the request handling process.

Instead, to avoid adding the use keyword to "request handling closures", we could use the Application#use method, like this:

And here, we see the third, but optional, parameter: the Application instance created by the user and used to define the route.

Final Considerations

I admit that those were a very few lines. But, in the future, the quality and detail of the documentation might get better.

Good studies, from 14mPr0gr4mm3r.


All versions of framework with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3
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 armor/framework contains the following files

Loading the files please wait ....