Download the PHP package utopia-php/framework without Composer

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

Build Status Total Downloads Discord

Utopia HTTP is a PHP MVC based framework with minimal must-have features for professional, simple, advanced and secure web development. This library is maintained by the Appwrite team.

Utopia HTTP is almost dependency-free. Any extra features, such as authentication or caching are available as standalone models in order to keep the framework core clean, light, and easy to learn.

Getting Started

Install using Composer:

Init your first application in src/server.php:

Run HTTP server:

Send HTTP request:

Server Adapters

The library supports server adapters to be able to run on any PHP setup. You could use the FPM or Swoole server.

Use PHP FPM server

When using PHP FPM, you can use the command php -S localhost:80 src/server.php to run the HTTP server locally

Using Swoole server

When using Swoole, you can use the command php src/server.php to run the HTTP server locally, but you need Swoole installed. For setup with Docker, check out our example application

Parameters

Parameters are used to receive input into endpoint action from the HTTP request. Parameters could be defined as URL parameters or in a body with a structure such as JSON.

Every parameter must have a validator defined. Validators are simple classes that verify the input and ensure the security of inputs. You can define your own validators or use some of built-in validators.

Define an endpoint with params:

Send HTTP requests to ensure the parameter works:

It's always recommended to use params instead of getting params or body directly from the request resource. If you do that intentionally, always make sure to run validation right after fetching such a raw input.

Hooks

There are three types of hooks:

You can provide multiple hooks for each stage. If you do not assign groups to the hook, by default, the hook will be executed for every route. If a group is defined on a hook, it will only run during the lifecycle of a request with the same group name on the action.

Hooks are designed to be actions that run during the lifecycle of requests. Hooks should include functional logic. Hooks are not designed to prepare dependencies or context for the request. For such a use case, you should use resources.

Groups

Groups allow you to define common behavior for multiple endpoints.

You can start by defining a group on an endpoint. Keep in mind you can also define multiple groups on a single endpoint.

Now you can define hooks that would apply only to specific groups. Remember, hooks can also be assigned to multiple groups.

Groups are designed to be actions that run during the lifecycle of requests to endpoints that have some logic in common. Groups allow you to prevent code duplication and are designed to be defined anywhere in your source code to allow flexibility.

Injections

Injections allow you to prepare dependencies for requests such as database connection or the user who sent the request. A new instance of a resource is created for every request.

We define an injection using a Container:

Inject resource into endpoint action:

Inject resource into a hook:

In advanced scenarios, resources can also be injected into other resources or endpoint parameters.

Resources are designed to prepare dependencies or context for the request. Resources are not meant to do functional logic or return callbacks. For such a use case, you should use hooks.

To learn more about architecture and features for this library, check out more in-depth Getting started guide.

System Requirements

Utopia HTTP requires PHP 8.1 or later. We recommend using the latest PHP version whenever possible.

More from Utopia

Our ecosystem supports other thin PHP projects aiming to extend the core PHP Utopia HTTP.

Each project is focused on solving a single, very simple problem and you can use composer to include any of them in your next project.

You can find all libraries in GitHub Utopia organization.

Contributing

All code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.

Fork the project, create a feature branch, and send us a pull request.

You can refer to the Contributing Guide for more info.

For security issues, please email [email protected] instead of posting a public issue in GitHub.

Copyright and license

The MIT License (MIT) http://www.opensource.org/licenses/mit-license.php


All versions of framework with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
utopia-php/compression Version 0.1.*
utopia-php/telemetry Version 0.1.*
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 utopia-php/framework contains the following files

Loading the files please wait ....