lcsng/amanda
最新稳定版本:v1.0.5
Composer 安装命令:
composer require lcsng/amanda
包简介
Amanda is a lightweight and flexible PHP routing library that dynamically maps website URLs to template files without requiring manual route definitions or directory structures. Simply place your .php or .html templates inside the amanda_templates/ directory, and Amanda will automatically serve them
README 文档
README
🚀 Amanda is a powerful and flexible PHP routing library that dynamically maps URLs to template files without requiring manual route definitions. It provides a simple yet robust way to handle requests, making web development faster and more efficient.
📌 Key Features
✅ Auto-routing – No need to manually define routes; Amanda maps URLs to templates automatically.
✅ Customizable & Lightweight – Easily modify template paths and routing logic.
✅ Dedicated Public Directory – Follows best practices by keeping core files separate from publicly accessible assets.
✅ Seamless Integration – Works with both existing PHP projects and new installations.
📥 Installation
1️⃣ Install Amanda as a Full Project
Amanda should be installed in a server directory that is not publicly accessible. You can install it using:
composer create-project lcsng/amanda my-site
This will create a my-site/ directory containing all necessary files and folders.
📂 Folder Structure
Amanda follows this directory setup:
my-site/ # Server directory (not public)
├── amanda/ # Core framework files (configs, functions, templates, etc.)
│ ├── amanda_templates/ # User templates (PHP/HTML)
│ ├── amanda_routers/ # Routing logic
│ └── ... (other core files)
│
├── public_html/ # The document root (publicly accessible files)
│ ├── index.php # Handles all requests
│ ├── amanda_ajax.php # For AJAX requests
│ ├── amanda_assets/ # Public assets (CSS, JS, images, etc.)
│ └── ... (other public files)
│
└── composer.json # Project dependencies
Folder Placement Notes:
🔹 my-site/ is not the document root—it is the server directory.
🔹 public_html/ is the document root, where web requests are directed.
🔹 Users can place Amanda anywhere that fits their project structure.
🚀 Getting Started
1️⃣ Place Your Templates
Simply put your .php or .html files inside the amanda/amanda_templates/ directory. Amanda will automatically route them based on the requested URL.
For example:
amanda_templates/
├── home.php → Access via `/home`
├── about.html → Access via `/about`
├── contact.php → Access via `/contact`
└── 404.html → Default 404 error page
2️⃣ Configure Routing (Optional)
Modify the amanda_routers/artd.php file to override defaults:
$amanda_router->template_dir = AMANDA_TEMPLATE_DIR; $amanda_router->error_404 = AMANDA_TEMPLATE_DIR . '/404.html'; // Custom template overrides $amanda_router->home = AMANDA_TEMPLATE_DIR . '/home2.php'; $amanda_router->add_template = [ 'cart' => AMANDA_TEMPLATE_DIR . '/cart.php' ];
📚 Documentation
For full documentation, visit lcs.ng/amanda.
🤝 Contributing
- Fork the repository.
- Make your changes.
- Submit a pull request.
📜 License
Amanda is licensed under GPL-3.0-or-later, meaning it is free to use, modify, and distribute while ensuring derivatives remain open-source.
📧 Contact & Support
📌 Author: Chinonso Frewen Justice (JCFuniverse)
📧 Email: amanda@lcs.ng
🌐 Website: lcs.ng/amanda
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2025-03-02