Download the PHP package laswitchtech/php-api without Composer

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

phpAPI - [DEPRECATED] - Use coreAPI instead

License GitHub repo size GitHub top language Version

Features

Why you might need it

If you are looking for an easy start for your PHP REST API. Then this PHP Class is for you.

Can I use this?

Sure!

License

This software is distributed under the GNU General Public License v3.0 license. Please read LICENSE for information on the software availability and distribution.

Requirements

Security

Please disclose any vulnerabilities found responsibly – report security issues to the maintainers privately.

Installation

Using Composer:

How do I use it?

In this documentations, we will use a table called users for our examples.

Skeleton

Let's start with the skeleton of your API project directory.

Models

Model files implements the necessary methods to interact with a table in the MySQL database. These model files needs to extend the Database class in order to access the database.

Naming convention

The name of your model file should start with a capital character and be followed by . If not, the bootstrap will not load it. The class name in your Model files should match the name of the model file.

Example

Controllers

Controller files holds the necessary application code to entertain REST API calls. Mainly the methods that can be called. These controller files needs to extend the BaseController class in order to access the basic methods.

Naming convention

The name of your controller file should start with a capital character and be followed by . If not, the bootstrap will not load it. The class name in your Controller files should match the name of the controller file.

Finally, callable methods need to end with .

Example

Configurations

The config file holds the configuration information of our API. Mainly, it will hold the database credentials. But you could use it to store other configurations. The configuration file must be stored in config/config.php. As this file is already being loaded in the bootstrap.

Example

API

The api file is the entry-point of our application. It will initiate the controller being called in our application. The file itself can be named any way you want. As long as you point your API calls to it. In our example we use api.php. This name is useful because it allows you to build a front-end using the index.php file and it also makes it obvious as the URL of your API.

Example

Calling the API

Once you have setup your first controller and model, you can start calling your api.

JavaScript Implementation

phpAPI comes packed with a JavaScript implementation. The class is available in /vendor/laswitchtech/php-api/dist/js/phpAPI.js.

Examples

For more example, look into the example folder.

Installer Example


All versions of php-api with dependencies

PHP Build Version
Package Version
Requires components/jquery Version ^3.6
laswitchtech/php-auth Version ^3.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 laswitchtech/php-api contains the following files

Loading the files please wait ....