Download the PHP package marcuwynu23/narciso without Composer

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

Packagist CI Stars PHP version Lightweight PHP web library. Routing, middleware, CORS, rate limiting, security headers, and database — no framework required. ➡️ **[Read the full user guide →](USER-GUIDE.md)**

Table of Contents


What Is Narciso?

Narciso is a lightweight PHP web library built on top of native PHP, inspired by FastAPI and Flask. It gives you a simple, expressive API for routing, middlewares, CORS, rate limiting, security headers, and database access — so you can build APIs and web apps quickly without a heavy framework.

What It Does

Why Use It?

Problem How Narciso Solves It
Heavy frameworks require boilerplate Narciso is ~500 lines of PHP; drop it in and start coding
CORS and security headers are tedious One call: $app->useCors([...]), $app->useSecurityHeaders()
Rate limiting needs middleware setup $app->useRateLimit(100, 60) — 1 line, in-memory, per-IP
Database config varies between MySQL/SQLite Single handleDatabase([...]) with type: mysql or type: sqlite
API format negotiation is boilerplate $app->sendAPI($data) auto-detects JSON vs XML from Accept header or ?format=
Server signature leaks tech stack $app->setPoweredBy(false) removes X-Powered-By entirely

The Philosophy

  1. Minimal setup, maximum value. A working API server in 10 lines of code.
  2. Your process stays yours. No forced directory structure, no service container, no DI. Just PHP.
  3. Native-first. Built on mysqli, SQLite3, and native PHP sessions — no runtime dependencies.

Use Cases

Scenario How Narciso Helps
JSON API backend Define routes with $app->route(), return JSON with $app->json() or $app->sendAPI(). CORS and rate limiting built in.
Rapid prototype Install via Composer, write a single PHP file, run with php -S. Zero config.
Microservice Lightweight enough to deploy as a standalone service. Add security headers and rate limiting in two lines.
Simple web app with database Connect MySQL or SQLite with handleDatabase(), render views with render().
API gateway / proxy Use the middleware pipeline to add logging, auth, and rate limiting before proxying requests.
Learning tool Read the ~500-line source to understand how routing, middleware, and request handling work in PHP.

Benefits for Developers


Advantages Over Other Tools

Aspect Narciso Laravel Slim Symfony Handwritten
Setup time ~10 seconds Minutes ~30 seconds Minutes Ongoing effort
Runtime dependencies 0 50+ 5 80+ 0
Learning curve Low High Medium High N/A
File size (source) ~500 lines 10,000s ~2,000 100,000s Varies
Database abstraction mysqli / SQLite3 Eloquent PDO Doctrine Custom
CORS middleware Built-in Package Package Bundle Custom
Rate limiting Built-in Package Package Bundle Custom
Security headers Built-in Middleware Package Bundle Custom
JSON/XML auto-detect Built-in Manual Manual Manual Custom
Path parameters :param Route params {param} {param} Custom
Middleware interface Yes Yes Yes Yes Custom
Template engine PHP includes Blade Twig/Plates Twig Custom
CLI tooling No Artisan No Maker N/A
ORM No Eloquent Optional Doctrine Custom
License Apache 2.0 MIT MIT MIT Your choice

Installation

Requires PHP 7.4+ and the json extension. For MySQL use, install php-mysql. For SQLite, install php-sqlite3.

Verify:


Quick Start

Create index.php:

Run it:

Test it:


API Reference

route(string $method, string $path, callable $handler)

Register a route handler.

Parameter Default Description
$method — HTTP method (GET, POST, PUT, DELETE, PATCH, etc.)
$path — URL pattern with optional :param segments
$handler — function($app, $params) callback

use($middleware)

Add a middleware to the pipeline.

Parameter Default Description
$middleware — Callable ($app, $next) or object implementing MiddlewareInterface

useSecurityHeaders(?array $headers = null)

Flag Default Description
$headers null Custom headers array or null for defaults

useCors(array $origins, array $methods, array $headers, bool $credentials, int $maxAge)

Flag Default Description
$origins ['*'] Allowed origins
$methods ['GET','POST','PUT','PATCH','DELETE','OPTIONS'] Allowed HTTP methods
$headers ['Content-Type','Authorization'] Allowed request headers
$credentials false Allow credentials
$maxAge 86400 Preflight cache in seconds

useRateLimit(int $maxRequests, int $windowSeconds)

Flag Default Description
$maxRequests — Max requests per window
$windowSeconds — Window duration in seconds

sendAPI($data, array $options)

Option Default Description
format 'json' 'json' or 'xml'
root 'response' XML root tag
xmlItemName 'item' XML list item tag
statusCode 200 HTTP status code

setPoweredBy($value)

Flag Default Description
$value — false to remove, '' for blank, string for custom, null to leave default

handleDatabase(array $config)

Key Default Description
type — 'mysql' or 'sqlite'
host 'localhost' MySQL host
database — Database name (MySQL) or file path (SQLite)
username — MySQL username
password — MySQL password

Configuration

Narciso uses method calls, not config files. Configuration precedence:

  1. Method arguments (highest)
  2. Built-in defaults (lowest)

Example Output

JSON Response

XML Response

Rate Limited Response


CI/CD Integration

GitHub Actions


Development

Prerequisite Version Purpose
PHP 7.4+ Runtime
Composer 2.x Dependency management

Project Structure


Architecture

  1. Application is the central class — it holds routes, middleware config, database config, and session state
  2. Routes are registered as (method, pattern, handler) tuples. Path parameters (:param) are converted to regex with named groups
  3. Middleware pipeline is an onion-wrapped array. Each middleware calls $next() to pass control inward
  4. Request dispatch happens in run(): middleware stack executes first, then route matching, then the matched handler
  5. Database connections are lazy — created on first access via $app->db magic getter
  6. API format detection checks ?format= query param first, then Accept header, then defaults to JSON

Contributing

See CONTRIBUTING.md for full details — coding standards, commit conventions, PR process, and more.


License

Narciso is open source under the Apache License, Version 2.0.


All versions of narciso with dependencies

PHP Build Version
Package Version
No informations.
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 marcuwynu23/narciso contains the following files

Loading the files please wait ...