arefshojaei/anchor

PHP local CDN manager

Maintainers

Package info

github.com/ArefShojaei/Anchor

Language:JavaScript

Type:project

pkg:composer/arefshojaei/anchor

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-06-16 13:24 UTC

This package is auto-updated.

Last update: 2026-06-16 13:24:56 UTC


README

PHP Version License GitHub

A lightweight and powerful Local CDN Manager built with PHP. Anchor allows you to download, manage, and serve frontend libraries locally with a simple CLI interface.

Perfect for developers who want a private CDN server without relying on external providers.

Cover

✨ Features

  • 📦 Package Management - Store and manage frontend libraries locally
  • 🚀 One Click Installation - Download multiple CDN packages using a single command
  • 🖥️ Built-in HTTP Server - Serve your local CDN directly from CLI
  • 📝 Package List Support - Manage packages using a simple text configuration file
  • Fast & Lightweight - Pure PHP implementation with minimal dependencies
  • 🛠️ CLI Interface - Simple and developer-friendly commands
  • 🔧 Custom Host & Port - Configure your local server easily

📥 Installation

Requirements

  • PHP 7.0 or higher
  • Composer (recommended)
  • Bash environment (optional for bulk downloads)

Using Composer

composer create-project arefshojaei/anchor my-cdn

Move into the project directory:

cd my-cdn

Clone Repository

git clone https://github.com/ArefShojaei/Anchor.git

Then:

cd Anchor
composer install

📋 CDN Package List

Anchor supports bulk package installation using a package list.

Location:

public/packages.txt

File format:

# [Category]
[package] [version] [url]

Example:

# CSS Frameworks
bootstrap 5.3.8 https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css

# JavaScript Libraries
jquery 3.7.1 https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js

🚀 One Click Package Download

If your environment supports Bash, run:

bash scripts/downloader.sh

This script reads packages.txt and downloads all defined packages automatically.

🛠 CLI Commands

Add a new CDN package

Pattern:

php bin/cli cdn add [package] [version] [url]

Example:

php bin/cli cdn add bootstrap 5.3.8 https://cdn.jsdelivr.net/npm/bootstrap@5.3.8/dist/css/bootstrap.min.css

Start Local CDN Server

Basic:

php bin/cli serve

Custom port:

php bin/cli serve --port:3000

Custom host:

php bin/cli serve --host:0.0.0.0

Custom host and port:

php bin/cli serve --host:0.0.0.0 --port:3000

After running the server, open your browser:

http://[host]:[port]

Your local packages and files inside the public/ directory will be available through this address.

📂 Project Structure

Anchor/
│
├── bin/
│   └── cli                 # CLI application
│
├── public/
│   ├── packages.txt        # CDN package definitions
│   └── packages/           # Downloaded libraries
│
├── scripts/
│   └── downloader.sh       # Bulk package downloader
│
├── src/                    # Core application source
│
├── composer.json
└── README.md

💡 Example Workflow

1. Add a package

php bin/cli cdn add alpinejs 3.14.0 https://cdn.jsdelivr.net/npm/alpinejs@3.14.0/dist/cdn.min.js

2. Start the server

php bin/cli serve --port:8080

3. Use your local CDN

<script src="http://localhost:8080/packages/alpinejs/3.14.0/cdn.min.js"></script>

🔥 Why Anchor?

Using a local CDN gives you:

  • Faster development environment
  • Offline availability
  • Full control over package versions
  • No dependency on third-party CDN availability
  • Better privacy for internal applications

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a new branch
git checkout -b feature/amazing-feature
  1. Commit your changes
git commit -m "Add amazing feature"
  1. Push your branch
git push origin feature/amazing-feature
  1. Open a Pull Request

👨‍💻 Author

Aref Shojaei

⭐ Show Your Support

If this project helps you, consider giving it a Star on GitHub.

It motivates further development and improvements.