An open API service indexing awesome lists of open source software.

https://github.com/erdum/php-weekend

A simple minimal set of functions provide you the ability to build API & web application with no setup time
https://github.com/erdum/php-weekend

hacktoberfest laravel php php-library php-package php-router php-router-standalone

Last synced: about 1 month ago
JSON representation

A simple minimal set of functions provide you the ability to build API & web application with no setup time

Awesome Lists containing this project

README

          

# PHP-Weekend

A simple minimal set of functions provide you the ability to build API & web application with no setup time

## Table of Contents

- [Features](#features)
- [Installation](#installation)
- [Usage](#usage)
- [Feedback](#feedback)
- [Contributors](#contributors)
- [License](#license)

## Features

- Routing with dynamic routes
- Templating
- Method for accessing request data
- Method for sending json data
- Customizable
- No design restriction build your API in anyway you want
- Zero configuration

## Installation

Install PHP-Weekend with composer

```bash
composer require erdum/php-weekend
```

Or install without composer on older PHP versions just copy the src directory and require the App.php and Router.php
```php
'Hello, World!'));
});

Router::get('/simple', function() {
App::send_response('This is the content.', 200, 'text/html');
});

Router::get('/get_pdf', function() {
App::send_file(__DIR__ . '/static/my_file.pdf');
});
```

## Usage

After installing the package your project directory will have the following

```bash
ls
```
- composer.json
- composer.lock
- vendor

Create an index.php file

```php
'Hello, World!']);
});

/*
Router also have
post
put
patch
delete
any
*/
```

You can get request data submitted in any format with a single function
- query Parameters
- form-data
- multipart/form-data
- application/json

```php
$request_payload], 201);
});
```

You can also build dynamic routes
```php
$name]);
});
```

You can also use templates create a directory called templates in your project root

```bash
mkdir templates
```
inside your templates directory you can build your templates like home.php

```php

= $data ?>


= $foo ?>

18): ?>
Hello

whatsapp

```

now you can render home.php template from your index file

```php
'Hello, World!',
'foo' => 'bar',
'age' => 18
]);
});
```

App also provides you the csrf functionality

```php



= set_csrf() ?>

```

now verify the csrf token in the handler
```php

## License
[![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/)