Download the PHP package sirmekus/zam without Composer

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

Zam

Zam helps to receive and process client request(s), return response to client with appropriate header for a more robust and easier development

Please note that database operations have been moved to its own special repository/package. If you need support for database operation use Ahia instead.

For receiving request from client you will likely do something like:

With this package you can simply do:

Installation

To get started all you need to do is:

and you're in. Please note that if you use Laravel framework then this package may clash with it because there exists functions with similar names as in Laravel. Zam, in Igbo language, means "Answer Me" and it does this exactly. If you use Laravel then you may not need this package.


Usage


Receiving/Accepting Request(s)

To accept request you just need to pass an optional configuration array to the request() function as key-value pairs. Only one key is important to be passed - the NAME key. E.g:

The possible configuration keys are:

Another way to receive input from client is by calling the request() function without any argument then access the expected input as a dynamic property on it. Example:

In the above example, if name is set in the form it'll return the value else it returns null.

Inputs are sanitized before being passed to your application. Note that this function can also sanitize arrays when passed to it. Validation should be done on client side including error checks.

Also, this package integrates well with Zam package when using AJAX for making request(s) from front end.

Note that you can accept any request with any HTTP verb. However, for requests that don't use the GET, POST or PUT method we encourage you to pass the request in "REQUEST PAYLOAD" (JSON) format (instead of Formdata). Also, to verify that the request uses a particular HTTP verb you should check the $_SERVER['REQUEST_METHOD']


Response(s)

This will typically be useful to users who use axios library or Zam package as the appropriate HTTP status header will be specified. E.g

You can pass an optional parameter as second argument to this function which is the HTTP status code to send to the client. By default a 200 HTTP status code is sent to the client. Example:

Note that you can also pass an array as argument to this function and it'll be converted to JSON before being sent to client.

The supported HTTP status code (and their meanings) you can pass and that can be sent to client are:

Only the code is needed to be passed.


Displaying Response to user(s)

This package exposes a function called error() which accepts the HTML field's name as argument and display any error related to that field as set by the server. E.g:

Now if there's an error for the name field above it will be displayed accordingly. You can do this for other fields as well by supplying the appropriate name.


Meanwhile

You can connect with me on LinkedIn for insightful tips and so we can grow our networks together.

Check our educational platform for High Schools i-runs.

And follow me on Twitter.

I encourage contribution even if it's in the documentation. Thank you, and I really hope you find this package helpful.


All versions of zam with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
vlucas/phpdotenv Version ^5.5
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 sirmekus/zam contains the following files

Loading the files please wait ....