Download the PHP package daycry/restserver without Composer

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

Donate

Rest Server

Rest Server with Doctrine for Codeigniter 4

Build Status Coverage Status Downloads GitHub release (latest by date) GitHub stars GitHub license

Version 7

This version breaks compatibility with previous versions, since it contains new automated features, restructuring of the database with new foreign keys, so if you update, check that the names of the tables are in the plural.

Installation via composer

Use the package with composer install

> composer require daycry/restserver

Manual installation

Download this repo and then enable it by editing app/Config/Autoload.php and adding the Daycry\RestServer namespace to the $psr4 array. For example, if you copied it into app/ThirdParty:

Configuration

Run command:

> php spark restserver:publish
> php spark settings:publish
> php spark cronjob:publish
> php spark jwt:publish

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default file will be present in app/Config/RestServer.php.

> php spark migrate -all

This command create rest server tables in your database.

If you want load and Example Seed you can use this command.

> php spark db:seed Daycry\RestServer\Database\Seeds\ExampleSeeder

More information about install doctrine: https://github.com/daycry/doctrine

Usage Loading Library

If you want change attributes before controller call:

If you need to validate the data, you can call validation method passing the string rules and Validation Config file y you need.

For Example: app/Config/Validation.php or if rules are in custom namespace app/Modules/Example/Config/Validation.php

$this->content contains a body content in the request. $this->args contains all params, get, post, headers,... but you can use the object $this->request for get this params if you want.

Validation function parameters

Fiels Desctiption
rule Name of rule
namespace Namespace that contains the rule
getShared true or false
filter If you want to limit the content of the body, exclusively to the parameters of the rule.

User Model Class

By default you can associate users with keys via the '\Daycry\RestServer\Models\UserModel' model, but you can customize it by creating an existing class of '\Daycry\RestServer\Libraries\User\UserAbstract'.

Example:

If you customize the user class, you have to modify the default configuration

Example:

Exceptions & block Invalid Attempts

If you want to use some custom exception to use it as a failed request attempt and allow the blocking of that IP, you have to create the static attribute authorized.

If authorized is false the system increases by 1 the failed attempts by that IP. Example:

OPTIONS

You can customize the requests independently using the petition table.

Fiels Value Options Desctiption
namespace_id This field contains the identifier of the ws_namespaces table, this table stores the namespaces of the classes, for example \App\Controllers\Auth
method login Use this field to configure the method of controller
http post get,post,put,patch, options Use this field to configure the method of controller
auth bearer false,basic,digest,bearer Use this field to configure the autentication method
log null null,1,0 Use this field if you want log the petition
limit null null,1,15 Use this field if you want to set a request limit, this value must be an integer
time null null,1,15 This field is used to know how often the request limit is reset ( Time in seconds Example: 3600 -> In this case you can do {limit} request in 3600 seconds)
level null null,1,10 Use this field to indicate the level of permissions in the request, if the token has level 1 and the request has level 3, you will not be able to make the request

You can fill the ws_namespaces automatically with a command.

This command search class in the namespace o namespaces that you want. You can set this namespaces in the RestServer.php config file.

Or creating a cronjob tasks editing CronJob.php config file like this.

More information about cronjob: https://github.com/daycry/cronjob

RESPONSE

The default response is in json but you can change to xml in the headers.

or

or you can set format in GET variable

INPUT BODY

The body of petition is json by default, but you can change it.

or

API TOKEN

You can sent api rest token in headers, GET or POST variable like this.

LANGUAGE

You can sent language like this.


All versions of restserver with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4 || ^8.0
daycry/encryption Version ^2.0
daycry/settings Version ^1.0
daycry/relations Version ^2.0
daycry/jwt Version ^1.0
daycry/class-finder Version ^2.2
daycry/cronjob Version ^2.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 daycry/restserver contains the following files

Loading the files please wait ....