定制 marcuwynu23/narciso 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

marcuwynu23/narciso

最新稳定版本:0.0.3

Composer 安装命令:

composer require marcuwynu23/narciso

包简介

'Narciso' is a web library built on top of native PHP, designed to provide developers with a set of tools and functionalities to simplify and enhance web development tasks. It aims to streamline common web development processes such as handling HTTP requests, managing sessions, accessing databases,

README 文档

README

Narciso

GitHub license GitHub stars GitHub issues

Narciso is a lightweight web library built on top of native PHP, designed to simplify and enhance web development tasks. It provides developers with a set of tools and functionalities to streamline common web development processes such as handling HTTP requests, managing sessions, accessing databases, and generating dynamic content.

packagist: https://packagist.org/packages/marcuwynu23/narciso

Inspiration

Narciso draws its inspiration from the story of Narcissus in Greek mythology. In the myth, Narcissus is a figure known for his beauty, but also for his tragic demise due to his obsession with his own reflection. Similarly, Narciso emphasizes the importance of self-reflection and introspection in web development, encouraging developers to build elegant and efficient applications while acknowledging that perfection is not always attainable. It recognizes that not all frameworks are flawless, but aims to cultivate an appreciation for the craftsmanship and beauty of well-crafted software, despite its imperfections.

Additionally, personally I developed this project to learn the web core of PHP native. Through Narciso, I aimed to deepen my understanding of web development principles and practices, honing my skills in building robust and secure web applications using PHP's native capabilities.

Furthermore, as an artistic movement, this project is inspired by the contemporary cultural phenomenon of narcissism and its implications on society. By addressing themes related to self-absorption and self-obsession, Narciso seeks to raise awareness about mental health issues and promote a more balanced approach to technology and self-expression.

Features

  • HTTP Request Handling: Easily handle HTTP requests and extract data from them.
  • Session Management: Manage user sessions with ease, including session name customization.
  • Cross-Origin Resource Sharing (CORS): Implement CORS headers for handling cross-origin requests.
  • Database Access: Connect to MySQL or SQLite databases and perform database operations securely.
  • Routing: Define routes and callbacks for handling different HTTP methods and URIs.
  • View Rendering: Render view files with data passed from the application.
  • Redirection: Redirect users to different URLs within the application.
  • JSON Response: Send JSON responses with appropriate content-type headers.

Installation

You can install Narciso via Composer. Add the following to your composer.json file:

{
  "require": {
    "marcuwynu23/narciso": "^0.0.2"
  }
}

or using composer commandline:

composer require marcuwynu23/narciso

Then run composer install to install the library.

Usage

<?php
require_once __DIR__ . '/vendor/autoload.php';


use Marcuwynu23\Narciso\Application;


$app = new Application();

$app->setViewPath(__DIR__ . '/views');
$app->handleSession();
$app->handleCORS();

$app->handleDatabase([
	'type' => 'mysql',
	'host' => 'localhost',
	'database' => 'northwind',
	'username' => 'user',
	'password' => 'user',
]);



$app->route('GET', '/', function () use ($app) {
	return $app->render('/home/index.view');
});



$app->route('GET', '/json', function () use ($app) {
	return $app->json(['message' => 'Hello World']);
});

How to Run

direct running using php cli:

php -S localhost:8080 -t <entry_point_directory>

using auto cli by create .autofile script:

+ php -S localhost:8080 -t <entry_point_directory>

then running it:

auto

Contributing

Contributions are welcome! If you have any suggestions, improvements, or new guides to add, feel free to contribute to this repository.

Happy coding!

统计信息

  • 总下载量: 8
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-03-05