PHPackages                             abdessattar23/path2url - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abdessattar23/path2url

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abdessattar23/path2url
======================

A robust PHP library that converts relative file paths to absolute URLs in HTML, CSS, and JavaScript files, with automatic backup creation and comprehensive logging

v1.0.0(1y ago)15MITPHPPHP &gt;=7.4

Since Nov 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/abdessattar23/path2url)[ Packagist](https://packagist.org/packages/abdessattar23/path2url)[ Docs](https://github.com/abdessattar23/path2url)[ RSS](/packages/abdessattar23-path2url/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

[![Path2URL Banner](https://raw.githubusercontent.com/abdessattar23/path2url/main/art/banner.png)](https://raw.githubusercontent.com/abdessattar23/path2url/main/art/banner.png)Path2URL
========

[](#path2url)

> 🚀 A robust PHP library for converting relative paths to absolute URLs

[![Latest Version on Packagist](https://camo.githubusercontent.com/3d4439e03a0c0f1c3be23cbd9dd2d84ecdbf30d8441667cb32d5b0b2fb4bcf36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264657373617474617232332f706174683275726c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abdessattar23/path2url)[![Total Downloads](https://camo.githubusercontent.com/40099250b3dd5c9a23582c50e72b3458d05afdfe92f0ef9b87f2ba9ffeb79994/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616264657373617474617232332f706174683275726c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/abdessattar23/path2url)[![License](https://camo.githubusercontent.com/70a0a71589927bda0a3dd3eac99a3e1770a43ce63df76088bed0b3eac5d52a42/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616264657373617474617232332f706174683275726c2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![PHP Version](https://camo.githubusercontent.com/80607b9a84edad0f310bceb3e532c97f81bf5ed5b43a20351aa89d90df8cd20a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f616264657373617474617232332f706174683275726c2e7376673f7374796c653d666c61742d737175617265)](composer.json)[![GitHub Stars](https://camo.githubusercontent.com/b979dea7452dedbb8197fafe387532ec0527f36eca977c25257541bdbb42ee4b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616264657373617474617232332f706174683275726c3f7374796c653d736f6369616c)](https://github.com/abdessattar23/path2url/stargazers)[![Follow on GitHub](https://camo.githubusercontent.com/abdc6f849ac371387a8e71e1cb0e6ec791c46e9e0583000ad2d467ea37819836/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f6c6c6f776572732f616264657373617474617232333f6c6162656c3d466f6c6c6f77267374796c653d736f6369616c)](https://github.com/abdessattar23)

📖 About Path2URL
----------------

[](#-about-path2url)

🛠️ Path2URL is a powerful PHP library designed to automatically convert relative file paths to absolute URLs in HTML, CSS, and JavaScript files. Perfect for migrating websites, setting up CDNs, or managing content across different environments.

> ⏰ Last Updated: 2024-11-12 14:53:36 UTC

✨ Features
----------

[](#-features)

🌟 **Key Features:**

- 🔄 Converts relative paths to absolute URLs
- 📁 Supports HTML, CSS, and JavaScript files
- 💾 Automatic backup creation before modifications
- 📝 Comprehensive logging system
- ⚙️ Configurable file extensions
- 🔒 Type-safe with PHP 7.4+ features

⚡ Installation
--------------

[](#-installation)

📦 Install the package via Composer:

```
composer require abdessattar23/path2url
```

🚀 Basic Usage
-------------

[](#-basic-usage)

```
use Path2URL\Path2URL;

// Initialize the converter
$converter = new Path2URL(
    '/path/to/your/files',
    'https://your-domain.com'
);

// Process all files
$stats = $converter->process();
```

🎯 Example Transformations
-------------------------

[](#-example-transformations)

### 📄 HTML Files

[](#-html-files)

```

```

### 🎨 CSS Files

[](#-css-files)

```
/* Before */
background-image: url('./images/bg.jpg');
background: url('../assets/pattern.png');

/* After */
background-image: url('https://your-domain.com/images/bg.jpg');
background: url('https://your-domain.com/assets/pattern.png');
```

⚙️ Advanced Configuration
-------------------------

[](#️-advanced-configuration)

```
// Custom configuration
$converter = new Path2URL(
    '/path/to/your/files',
    'https://your-domain.com',
    ['html', 'css', 'js', 'xml'],  // Custom file extensions
    'custom_log.log'               // Custom log file
);
```

📊 Logging Example
-----------------

[](#-logging-example)

```
[2024-11-12 13:46:07] [INFO] Starting URL conversion process
[2024-11-12 13:46:07] [INFO] Processing file: /path/to/file.html
[2024-11-12 13:46:07] [INFO] Created backup: file.html.1731417583.bak
[2024-11-12 13:46:07] [INFO] Successfully processed file

```

📋 Requirements
--------------

[](#-requirements)

- 💻 PHP 7.4 or higher
- 📦 Composer for dependency management

🧪 Testing
---------

[](#-testing)

Run the test suite:

```
composer test
```

🔐 Security
----------

[](#-security)

🛡️ Found a security issue? Please email [abdessattar23](https://github.com/abdessattar23) instead of using the issue tracker.

🤝 Contributing
--------------

[](#-contributing)

Contributions are welcome! Please see [CONTRIBUTING](https://docs.github.com/en/contributing) for details.

📜 License
---------

[](#-license)

⚖️ The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

🗺️ Roadmap
----------

[](#️-roadmap)

- 🖥️ CLI interface implementation
- 📁 Additional file type support
- ⚙️ Custom URL transformation rules
- 🔌 Framework integrations
- ⚡ Real-time processing option

👥 Credits
---------

[](#-credits)

- 👨‍💻 Author: [abdessattar23](https://github.com/abdessattar23)
- 🌟 [All Contributors](../../contributors)

🌐 Social
--------

[](#-social)

[![Twitter Follow](https://camo.githubusercontent.com/94729ddc54a87cb81a8d39daddbcec28abae50f2d477ad084fb84bcb80e1ce96/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f616264657373617474617232333f7374796c653d736f6369616c)](https://twitter.com/abdessattar23)[![LinkedIn](https://camo.githubusercontent.com/b3cbd0f42a5ac764245b677aac8b374bd83303173c201694e1e091e642a4a4bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c696e6b6564496e2d436f6e6e6563742d626c75653f7374796c653d736f6369616c266c6f676f3d6c696e6b6564696e)](https://linkedin.com/in/abdessattar23)

💝 Support
---------

[](#-support)

If you found this package helpful, please consider:

- ⭐ Starring the repository
- 🐛 [Reporting issues](https://github.com/abdessattar23/path2url/issues)
- 🤝 Contributing to the code
- ☕ [Buy me a coffee](https://buymeacoffee.com/abdessattar23)

📊 Project Stats
---------------

[](#-project-stats)

 [![Repo Stats ](https://camo.githubusercontent.com/6860cc6412f108a534f4dac6ff9cd44eca3d83f61fcbe318ea1939a59a13b1dc/68747470733a2f2f6769746875622d726561646d652d73746174732e76657263656c2e6170702f6170692f70696e2f3f757365726e616d653d61626465737361747461723233267265706f3d706174683275726c267468656d653d6461726b)](https://camo.githubusercontent.com/6860cc6412f108a534f4dac6ff9cd44eca3d83f61fcbe318ea1939a59a13b1dc/68747470733a2f2f6769746875622d726561646d652d73746174732e76657263656c2e6170702f6170692f70696e2f3f757365726e616d653d61626465737361747461723233267265706f3d706174683275726c267468656d653d6461726b)

---

🔥 Created and maintained by [abdessattar23](https://github.com/abdessattar23)

If this package helps your project, please consider giving it a ⭐

 Built with ❤️ by the PHP community

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

599d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/106479409?v=4)[Mohammed AbdessetarElyagoubi](/maintainers/abdessattar23)[@abdessattar23](https://github.com/abdessattar23)

---

Top Contributors

[![abdessattar23](https://avatars.githubusercontent.com/u/106479409?v=4)](https://github.com/abdessattar23 "abdessattar23 (9 commits)")

---

Tags

web-toolsphp urlurl-converterpath-converterurl-transformationhtml-urlscss-urlsrelative-to-absolutepath-resolverurl-processor

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/abdessattar23-path2url/health.svg)

```
[![Health](https://phpackages.com/badges/abdessattar23-path2url/health.svg)](https://phpackages.com/packages/abdessattar23-path2url)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
