Download the PHP package berkan/server without Composer

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

BERKAN
PHP Development Environment for macOS
macOS için PHP Geliştirme Ortamı

PHP 5.6-8.4 macOS Apache | Nginx Databases MIT License Version 1.0.0


Table of Contents / İçindekiler


English

What is Berkan?

Berkan is a lightweight macOS PHP development environment that supports both Apache (httpd) and Nginx as web servers. Choose your preferred web server during installation, switch between them at any time, and manage PHP versions and databases from a single CLI.

Berkan configures your Mac to always run your chosen web server, PHP-FPM, and DnsMasq in the background when your machine starts. Then, using DnsMasq, Berkan proxies all requests on the .test TLD to point to sites installed on your local machine.

In other words, a blazing fast macOS PHP development environment that uses roughly 7 MB of RAM. Berkan isn't a complete replacement for Vagrant or Docker, but it's a great alternative if you want a flexible, speed-focused baseline.

Features

Web Server (Apache or Nginx)

Berkan lets you choose between Apache and Nginx during installation, and switch at any time with berkan server:switch.

Apache (httpd):

Nginx:

Site Serving

HTTPS / SSL

PHP Management

Error Display Control

Short Open Tag

Database Management

DNS Resolution

Proxy

Sharing

Framework Drivers

System Integration

Diagnostics & Logging

Requirements

Installation

Step 1: Install Homebrew

If you don't have Homebrew installed, run:

Step 2: Install PHP and Composer

Step 3: Install Berkan

Note: Make sure Composer's global vendor bin directory is in your PATH. Add one of the following to your shell profile (~/.zshrc or ~/.bashrc):

Then restart your terminal or run source ~/.zshrc.

Step 4: Install Berkan Services

This is an interactive installer that will guide you through the setup. It automatically checks for Homebrew, PHP, and Composer — installing any that are missing.

1. Web Server Selection:

2. PHP Version Selection (multi-select):

Select one or more PHP versions. The latest version you select will be set as the active version. Older versions (5.6–8.0) are installed via the shivammathur/php Homebrew tap (added automatically).

3. Database Selection (multi-select):

Select the databases you need, or choose "None" to skip. You can always install databases later with berkan db:install.

4. Port Configuration (automatic):

If ports 80 or 443 are already in use by another process, Berkan will detect the conflict and offer alternative ports:

If no conflict is detected, Berkan silently uses the default ports 80/443. Custom ports are saved in config.json and all server configurations are automatically updated.

Step 5: Trust Berkan (Recommended)

This step adds Berkan to sudoers so you don't need to type your password for common operations like start, stop, restart, secure, etc.:

Step 6: Verify Installation

You should see all services running:

Run diagnostics to make sure everything is correctly configured:

Step 7: Park Your Projects Directory

Berkan will scan the directory, detect each project's framework, and interactively ask which PHP version to use for each project:

Projects assigned a specific PHP version will be isolated with their own PHP-FPM pool and socket. Projects set to "Default" will use the globally linked PHP version.

Now any folder you create inside ~/Sites/ will automatically be accessible as http://folder-name.test in your browser.

What berkan install Does (Step by Step)

  1. Checks for Homebrew — if not installed, runs the official Homebrew installer automatically
  2. Checks for Composer — if not installed, installs it via Homebrew
  3. Asks you to choose a web server (Apache or Nginx), PHP versions, and databases
  4. Detects port conflicts on 80/443 and lets you choose alternative ports if needed
  5. Creates the configuration directory at ~/.config/berkan/
  6. Creates subdirectories: Apache/ or Nginx/, Certificates/, Drivers/, Sites/, Log/, dnsmasq.d/
  7. Saves your choices (including port configuration) to ~/.config/berkan/config.json
  8. Installs the chosen web server via Homebrew (if not already installed)
  9. Writes the main server configuration (httpd.conf for Apache or nginx.conf for Nginx) with configured ports
  10. Creates the default catch-all server configuration (routes all .test requests to server.php)
  11. Configures PHP-FPM with a berkan pool using Unix socket (~/.config/berkan/berkan.sock)
  12. Installs additional PHP versions you selected via Homebrew (adds shivammathur/php tap for older versions)
  13. Installs and configures DnsMasq to resolve all *.test domains to 127.0.0.1
  14. Creates macOS resolver file at /etc/resolver/test
  15. Installs and starts selected databases via Homebrew
  16. Starts all services (brew services start)
  17. Symlinks the berkan executable to /usr/local/bin/berkan
  18. Copies a sample custom driver to ~/.config/berkan/Drivers/

Updating Berkan

Alternative: Manual Installation

If you prefer to install from source:

To update a manual installation:

Quick Start

That's it. Every folder inside ~/Sites/ is now automatically available as http://folder-name.test. Legacy projects can run older PHP versions side by side with modern ones.

Commands Reference

Service Management

Command Description
berkan install Install Berkan services (interactive web server, PHP, database selection)
berkan uninstall Uninstall Berkan (asks for confirmation)
berkan uninstall --force Force uninstall and remove all configuration
berkan start Start all Berkan services
berkan stop Stop all Berkan services
berkan restart Restart all Berkan services
berkan status Display service status table
berkan trust Add Berkan to sudoers (no more password prompts)

Site Management

Command Description
berkan park [path] Register directory as a parked path with interactive project scanning and per-project PHP version selection
berkan parked List all parked directories
berkan forget [path] Remove a parked path
berkan link [name] Create a symbolic link for the current directory
berkan links List all linked sites with SSL status, URLs, and PHP version
berkan unlink [name] Remove a linked site
berkan open [name] Open site in default browser
berkan paths Display all registered paths

HTTPS / SSL

Command Description
berkan secure [name] Enable HTTPS with a self-signed trusted certificate
berkan secured List all secured sites
berkan unsecure [name] Remove HTTPS and revert to HTTP

PHP Management

Command Description
berkan use <version> Switch global PHP version (e.g., berkan use 8.3)
berkan php:install <version> Install a new PHP version (e.g., berkan php:install 8.2)
berkan php:remove <version> Remove a PHP version
berkan php:list List all installed PHP versions with status
berkan which-php Display the currently active PHP version
berkan php [args...] Run PHP CLI with Berkan's version
berkan composer [args...] Run Composer with Berkan's PHP version
berkan isolate <version> Isolate current site to a specific PHP version
berkan unisolate Remove PHP isolation from current site
berkan isolated List all isolated sites and their PHP versions

Database Management

Command Description
berkan db:install <name> Install a database (mysql, postgresql, mongodb, redis)
berkan db:uninstall <name> Uninstall a database
berkan db:start [name] Start a database (or all installed databases)
berkan db:stop [name] Stop a database (or all installed databases)
berkan db:restart [name] Restart a database (or all installed databases)
berkan db:list List all supported databases and their status

Web Server

Command Description
berkan server:switch Switch between Apache and Nginx

Proxy

Command Description
berkan proxy <name> <url> Create a proxy (e.g., berkan proxy myapi http://localhost:3000)
berkan proxy <name> <url> --secure Create a proxy with HTTPS
berkan proxies List all proxy sites
berkan unproxy <name> Remove a proxy

Sharing

Command Description
berkan share [name] Share a site publicly via tunnel
berkan share-tool [tool] Get or set the sharing tool (ngrok, expose, cloudflared)
berkan fetch-share-url Fetch the current share URL
berkan set-ngrok-token <token> Set Ngrok auth token

Configuration

Command Description
berkan tld [name] Get or set the TLD (default: test)
berkan loopback [address] Get or set the loopback IP (default: 127.0.0.1)
berkan directory-listing [on/off] Toggle directory listing
berkan shorttag on Enable PHP short_open_tag (<? syntax) on all PHP versions
berkan shorttag off Disable PHP short_open_tag on all PHP versions
berkan shorttag Display current short_open_tag status
berkan error hide Hide PHP errors (notices, warnings, deprecations) on all sites
berkan error show Show PHP errors on all sites
berkan on-latest-version Display current Berkan version

Diagnostics

Command Description
berkan diagnose Run full diagnostics and display results
berkan log [service] View logs (apache/nginx, php, php-fpm, access)
berkan log List all available log files

Serving Sites

Berkan supports two ways to serve your PHP projects:

The park Command

The park command registers a directory and interactively scans it for projects. Every subdirectory within a parked directory becomes automatically accessible as a .test site.

Berkan will scan the directory, detect each project's framework (Laravel, Symfony, WordPress, Drupal, Magento 2, Craft CMS, Joomla, Composer, Plain PHP, etc.), and ask which PHP version to assign:

Each project assigned a specific PHP version gets an isolated PHP-FPM pool with its own socket (e.g., berkan-7.4.sock). This means different projects can run entirely different PHP versions simultaneously.

You can park multiple directories:

To stop serving a directory:

The link Command

The link command creates a symbolic link for a single site. This is useful when you want to serve a single directory from a non-parked location, or when you want the site name to differ from the folder name.

How Request Routing Works

Apache:

  1. A request for myapp.test arrives at Apache
  2. The site's .htaccess rewrite rules run first (if any)
  3. If no .htaccess rule matched, Berkan's fallback rule routes unmatched requests to server.php (via RewriteOptions InheritDown)
  4. server.php extracts the site name from the hostname
  5. The driver system auto-detects the framework (Laravel, WordPress, etc.)
  6. The appropriate front controller is loaded and executed

Nginx:

  1. A request for myapp.test arrives at Nginx
  2. The server block routes it to server.php
  3. server.php extracts the site name from the hostname
  4. It looks for a matching linked site or parked directory
  5. The driver system auto-detects the framework
  6. The appropriate front controller is loaded and executed

Note: Apache uses RewriteOptions InheritDown so that your project's .htaccess rules always take priority over Berkan's fallback routing. This means traditional PHP sites with custom rewrite rules (e.g., multilingual routing like /tr/subeler.php) work natively without modification.

HTTPS / SSL

Berkan can secure any site with a trusted self-signed TLS certificate with a single command. This works identically whether you're using Apache or Nginx.

Securing a Site

This will:

  1. Generate a 2048-bit RSA private key
  2. Create a self-signed certificate with SAN (Subject Alternative Name)
  3. Trust the certificate in the macOS System Keychain
  4. Create the appropriate web server configuration (Apache VirtualHost or Nginx server block)
  5. Set up HTTP-to-HTTPS redirect
  6. Enable HTTP/2 support
  7. Add HSTS header
  8. Restart the web server

Unsecuring a Site

This removes the certificate, untrusts it from Keychain, and removes the SSL configuration.

Listing Secured Sites

PHP Version Management

Berkan supports PHP versions from 5.6 to 8.4. Versions 8.1–8.4 are available from the standard Homebrew formula. Older versions (5.6–8.0) are provided by the shivammathur/php tap, which Berkan adds automatically when needed.

Supported PHP Versions

Version Source Formula
PHP 8.4 Homebrew php or [email protected]
PHP 8.3 Homebrew [email protected]
PHP 8.2 Homebrew [email protected]
PHP 8.1 Homebrew [email protected]
PHP 8.0 shivammathur/php [email protected]
PHP 7.4 shivammathur/php [email protected]
PHP 7.3 shivammathur/php [email protected]
PHP 7.2 shivammathur/php [email protected]
PHP 7.1 shivammathur/php [email protected]
PHP 7.0 shivammathur/php [email protected]
PHP 5.6 shivammathur/php [email protected]

Global PHP Switching

Installing and Removing PHP Versions

Per-Site PHP Isolation

You can isolate individual sites to use different PHP versions. Each isolated site gets its own PHP-FPM pool and socket:

Per-Project PHP via berkan park

When you run berkan park, Berkan scans the directory and lets you assign PHP versions per project interactively. See The park Command for details.

Using PHP CLI

Database Management

Berkan can install and manage databases directly from the CLI.

Supported Databases

Database Install Command Formula
MySQL berkan db:install mysql mysql
PostgreSQL berkan db:install postgresql postgresql@17
MongoDB berkan db:install mongodb mongodb-community
Redis berkan db:install redis redis

Installing a Database

MongoDB requires the mongodb/brew tap, which Berkan handles automatically.

Managing Databases

Checking Database Status

Installed databases also appear in berkan status:

Web Server Selection

Choosing During Installation

When you run sudo berkan install, Berkan asks which web server you want:

Switching Web Servers

You can switch between Apache and Nginx at any time:

This will:

  1. Confirm the switch (e.g., "Switch from Apache to Nginx?")
  2. Stop the current web server
  3. Update the configuration
  4. Install and configure the new web server
  5. Update sudoers entries
  6. Start the new web server

All your sites, certificates, and configurations continue to work seamlessly after switching.

Differences Between Apache and Nginx

Feature Apache Nginx
.htaccess support Native Not supported
Config test command apachectl configtest nginx -t
Config directory ~/.config/berkan/Apache/ ~/.config/berkan/Nginx/
Log prefix apache-error.log nginx-error.log
PHP connection mod_proxy_fcgi (Unix socket) fastcgi_pass (Unix socket)
Proxy support mod_proxy_http proxy_pass

Site Proxying

Berkan can proxy .test domains to other local services like Node.js, Go, Python, or Docker containers.

Proxy configurations include WebSocket support for both Apache and Nginx.

Sharing Sites

Berkan supports three tunneling tools for sharing local sites publicly:

Using Ngrok (Default)

Using Expose

Using Cloudflare Tunnel

Checking Current Tool

Custom Drivers

If Berkan doesn't auto-detect your application, you can write a custom driver.

Creating a Driver

A sample driver is placed at ~/.config/berkan/Drivers/SampleBerkanDriver.php during installation. Create a new file in that directory:

Note: The isStaticFile() method omits the return type declaration for compatibility with PHP 7.x isolated sites. Use a @return docblock instead.

Driver Resolution Order

  1. Custom drivers in ~/.config/berkan/Drivers/ (highest priority)
  2. Specific drivers (WordPress, Laravel, Symfony, etc.)
  3. Default drivers (BasicWithPublicBerkanDriver, BasicBerkanDriver)

The first driver whose serves() method returns true will handle the request.

Supported Frameworks

Berkan includes built-in drivers for 25 frameworks and CMS platforms:

Framework Detection
Laravel artisan or bootstrap/app.php + public/index.php
WordPress wp-config.php + wp-admin/
WordPress Bedrock web/wp/wp-settings.php
Symfony bin/console + public/index.php
Drupal core/lib/Drupal.php
Joomla configuration.php + libraries/
CakePHP config/app.php + webroot/index.php
Magento 2 bin/magento + pub/index.php
Craft CMS craft file
Statamic v3+ Laravel + statamic/cms in composer.json
Statamic v2 statamic/ dir + please file
Statamic v1 _app/core/statamic.php
Kirby CMS kirby/ directory
Contao system/initialize.php or vendor/contao/
Concrete5 concrete/dispatcher.php
TYPO3 typo3/ dir + typo3conf/ or config/system/settings.php
Neos CMS flow file
Nette app/bootstrap.php + www/index.php
Jigsaw build_local/ directory
Sculpin output_dev/ or output_prod/ directory
Katana public/_katana/ directory
Radicle web/wp/wp-settings.php + config/application.php
Basic with /public Any project with a public/ directory
Basic Fallback for any PHP project

Configuration

Configuration File

The main configuration file is at ~/.config/berkan/config.json:

Key Description Default
tld Top-level domain for sites test
loopback Loopback IP address 127.0.0.1
http_port HTTP port for the web server 80
https_port HTTPS port for the web server 443
paths Parked directories []
web_server Active web server (apache or nginx) apache
php_versions Installed PHP versions ["8.4"]
databases Installed databases []
isolated_versions Per-site PHP version assignments {}
hide_errors Hide PHP errors on all sites (berkan error hide/show) false
short_open_tag Enable PHP short_open_tag (berkan shorttag on/off) false

Configuration Directories

Directory Purpose
~/.config/berkan/config.json Main configuration
~/.config/berkan/Apache/ Apache VirtualHost configurations (when using Apache)
~/.config/berkan/Nginx/ Nginx server configurations (when using Nginx)
~/.config/berkan/Certificates/ SSL certificates and keys
~/.config/berkan/Drivers/ Custom user drivers
~/.config/berkan/Sites/ Symbolic links for linked sites
~/.config/berkan/Log/ Web server, PHP, and PHP-FPM logs
~/.config/berkan/dnsmasq.d/ DnsMasq TLD configuration
~/.config/berkan/berkan.sock PHP-FPM Unix socket (global/default)
~/.config/berkan/berkan-7.4.sock Isolated PHP-FPM socket (example: PHP 7.4)
~/.config/berkan/berkan_prepend.php PHP auto-prepend file for error display control

System Files

File Purpose
/etc/resolver/test macOS DNS resolver for .test TLD
/etc/sudoers.d/berkan Sudoers entries (after berkan trust)
$(brew --prefix)/etc/httpd/httpd.conf Apache main configuration (when using Apache)
$(brew --prefix)/etc/nginx/nginx.conf Nginx main configuration (when using Nginx)
$(brew --prefix)/etc/dnsmasq.conf DnsMasq main configuration

Changing the TLD

Changing the Loopback Address

Error Display Control

Berkan can globally hide or show PHP errors (notices, warnings, deprecations, etc.) across all your sites:

This uses PHP-FPM's auto_prepend_file mechanism, which injects a small script (berkan_prepend.php) before every PHP request. The script reads the hide_errors setting from config.json and suppresses error display accordingly.

This approach works reliably across all scenarios:

The setting takes effect immediately for new requests without requiring a service restart.

Short Open Tag

Berkan can globally enable or disable PHP's short_open_tag directive, which controls whether the <? short tag syntax is allowed (in addition to the standard ````

Anahtar Açıklama Varsayılan
tld Siteler için üst düzey alan adı test
loopback Loopback IP adresi 127.0.0.1
http_port Web sunucu HTTP portu 80
https_port Web sunucu HTTPS portu 443
paths Park edilmiş dizinler []
web_server Aktif web sunucu (apache veya nginx) apache
php_versions Kurulu PHP versiyonları ["8.4"]
databases Kurulu veritabanları []
isolated_versions Site bazlı PHP versiyon atamaları {}
hide_errors Tüm sitelerde PHP hatalarını gizle (berkan error hide/show) false
short_open_tag PHP short_open_tag etkinleştir (berkan shorttag on/off) false

Konfigürasyon Dizinleri

Dizin Amaç
~/.config/berkan/config.json Ana konfigürasyon
~/.config/berkan/Apache/ Apache VirtualHost konfigürasyonları (Apache kullanılırken)
~/.config/berkan/Nginx/ Nginx sunucu konfigürasyonları (Nginx kullanılırken)
~/.config/berkan/Certificates/ SSL sertifikaları ve anahtarları
~/.config/berkan/Drivers/ Özel kullanıcı driver'ları
~/.config/berkan/Sites/ Bağlantılı siteler için sembolik bağlantılar
~/.config/berkan/Log/ Web sunucu, PHP ve PHP-FPM log'ları
~/.config/berkan/dnsmasq.d/ DnsMasq TLD konfigürasyonu
~/.config/berkan/berkan.sock PHP-FPM Unix soketi (global/varsayılan)
~/.config/berkan/berkan-7.4.sock İzole PHP-FPM soketi (örnek: PHP 7.4)
~/.config/berkan/berkan_prepend.php Hata görüntüleme kontrolü için PHP auto-prepend dosyası

Sistem Dosyaları

Dosya Amaç
/etc/resolver/test .test TLD için macOS DNS çözümleyici
/etc/sudoers.d/berkan Sudoers kayıtları (berkan trust sonrası)
$(brew --prefix)/etc/httpd/httpd.conf Apache ana konfigürasyonu (Apache kullanılırken)
$(brew --prefix)/etc/nginx/nginx.conf Nginx ana konfigürasyonu (Nginx kullanılırken)
$(brew --prefix)/etc/dnsmasq.conf DnsMasq ana konfigürasyonu

TLD Değiştirme

# .test'ten .dev'e değiştir
sudo berkan tld dev

# Artık siteler *.test yerine *.dev'de
# http://myapp.dev

# Mevcut TLD'yi kontrol et
berkan tld
# Çıktı: dev

Loopback Adresi Değiştirme

sudo berkan loopback 10.200.10.1

# Mevcut loopback'i kontrol et
berkan loopback
# Çıktı: 10.200.10.1

Hata Görüntüleme Kontrolü

Berkan, tüm sitelerinizde PHP hatalarını (notice, warning, deprecation, vb.) toplu olarak gizleyip gösterebilir:

# Tüm sitelerde PHP hatalarını gizle
berkan error hide

# PHP hatalarını tekrar göster
berkan error show

Bu özellik PHP-FPM'in auto_prepend_file mekanizmasını kullanır. Her PHP isteğinden önce küçük bir script (berkan_prepend.php) enjekte edilir. Script, config.json'daki hide_errors ayarını okur ve hata görüntülemeyi buna göre bastırır.

Bu yaklaşım tüm senaryolarda güvenilir şekilde çalışır:

Ayar, servis yeniden başlatma gerektirmeden yeni istekler için anında etki eder.

Short Open Tag

Berkan, PHP'nin short_open_tag direktifini toplu olarak etkinleştirip devre dışı bırakabilir. Bu direktif, standart <?php etiketine ek olarak <? kısa tag sözdiziminin kullanılıp kullanılamayacağını kontrol eder:

# Short open tag'i etkinleştir (<? sözdizimi)
berkan shorttag on

# Short open tag'i devre dışı bırak (sadece <?php çalışır)
berkan shorttag off

# Mevcut durumu kontrol et
berkan shorttag

short_open_tag bir PHP_INI_PERDIR direktifi olduğu için ini_set() ile runtime'da değiştirilemez. Berkan bunu, her kurulu PHP versiyonunun conf.d dizinine özel bir .ini dosyası (berkan-short-open-tag.ini) yazarak ve PHP-FPM'i yeniden başlatarak halleder.

Ayar, tüm kurulu PHP versiyonlarına aynı anda uygulanır.

Log ve Tanı

Logları Görüntüleme

# Tüm log dosyalarını listele
berkan log

# Web sunucu hata logunu canlı takip et
berkan log apache    # Apache kullanılırken
berkan log nginx     # Nginx kullanılırken

# PHP hata logunu görüntüle
berkan log php

# PHP-FPM logunu görüntüle
berkan log php-fpm

# Erişim logunu görüntüle
berkan log access

Tanı Çalıştırma

berkan diagnose

Bu, kapsamlı bir tanı raporu görüntüler:

Berkan Diagnostics
==================================================
+-------------------------+-----------------------------------+
| Check                   | Result                            |
+-------------------------+-----------------------------------+
| Berkan Version          | 1.0.0                             |
| PHP Version             | 8.4.18                            |
| PHP Binary              | /opt/homebrew/opt/[email protected]/bin/php |
| Operating System        | Darwin 24.6.0                     |
| Homebrew Prefix         | /opt/homebrew                     |
| TLD                     | test                              |
| Loopback                | 127.0.0.1                         |
| Web Server              | apache                            |
| Apache (httpd) Status   | Running                           |
| PHP-FPM Status          | Running                           |
| DnsMasq Status          | Running                           |
| Apache (httpd) Config   | Found                             |
| PHP-FPM Socket          | Found                             |
| DNS Resolver            | Found                             |
| Installed PHP           | [email protected], [email protected]                  |
| Linked PHP              | [email protected]                           |
| Apache (httpd) Config T.| Syntax OK                         |
| Parked Paths            | /Users/siz/Sites                  |
| DNS Test                | 127.0.0.1                         |
| Installed Databases     | mysql, redis                      |
+-------------------------+-----------------------------------+

Mimari

Teknoloji Yığını

                    İstek Akışı
                    ===========

Tarayıcı (myapp.test)
        |
        v
   DnsMasq (DNS)              *.test -> 127.0.0.1 çözümler
        |
        v
   Apache veya Nginx           127.0.0.1:80/443 dinler
        |
        v
   .htaccess kuralları         (Yalnızca Apache) Sitenin kendi rewrite kuralları önce çalışır
        |
        v
   server.php                  Yedek istek yönlendirici (eşleşmeyen istekler)
        |
        v
   Driver Sistemi              Framework'ü otomatik algılar
        |
        v
   PHP-FPM                     Unix soketi üzerinden PHP çalıştırır
        |                      (hata kontrolü için auto_prepend_file)
        v
   Uygulamanız                 Laravel, WordPress, vb.

Proje Yapısı

server/
├── berkan                    # Ana çalıştırılabilir dosya (bash)
├── server.php                # HTTP istek yönlendirici
├── find-usable-php.php       # PHP 8.1+ ikili bulucu
├── composer.json              # Bağımlılıklar
├── cli/
│   ├── berkan.php            # CLI giriş noktası ve konteyner kurulumu
│   ├── app.php               # 48 komut tanımı
│   ├── includes/
│   │   └── helpers.php       # Yardımcı fonksiyonlar
│   ├── stubs/                # Konfigürasyon şablonları
│   │   ├── httpd.conf        # Apache ana konfig
│   │   ├── berkan.conf       # Apache varsayılan catch-all VirtualHost
│   │   ├── site.berkan.conf  # Apache site bazlı VirtualHost (InheritDown)
│   │   ├── secure.berkan.conf # Apache HTTPS VirtualHost (InheritDown)
│   │   ├── proxy.berkan.conf  # Apache proxy VirtualHost
│   │   ├── secure.proxy.berkan.conf # Apache güvenli proxy
│   │   ├── nginx.conf         # Nginx ana konfig
│   │   ├── nginx-berkan.conf  # Nginx varsayılan catch-all sunucu
│   │   ├── nginx-site.berkan.conf  # Nginx site bazlı sunucu
│   │   ├── nginx-secure.berkan.conf # Nginx HTTPS sunucu
│   │   ├── nginx-proxy.berkan.conf  # Nginx proxy sunucu
│   │   ├── nginx-secure.proxy.berkan.conf # Nginx güvenli proxy
│   │   ├── etc-phpfpm-berkan.conf  # PHP-FPM havuz şablonu
│   │   ├── etc-phpfpm-berkan-isolated.conf # İzole PHP-FPM havuz şablonu
│   │   ├── berkan_prepend.php # Hata görüntüleme kontrolü için PHP auto-prepend
│   │   └── ...               # Daha fazla şablon
│   ├── templates/
│   │   └── 404.html          # Özel 404 sayfası
│   └── Berkan/               # PHP sınıfları (PSR-4: Berkan\)
│       ├── Contracts/
│       │   └── WebServer.php  # WebServer arayüzü (interface)
│       ├── Apache.php         # Apache yönetimi (WebServer implement eder)
│       ├── Nginx.php          # Nginx yönetimi (WebServer implement eder)
│       ├── Berkan.php         # Ana sınıf
│       ├── Brew.php           # Homebrew entegrasyonu
│       ├── CommandLine.php    # Kabuk komut çalıştırma
│       ├── Composer.php       # Composer paket yönetimi
│       ├── Configuration.php  # Konfigürasyon yönetimi
│       ├── Database.php       # Veritabanı yönetimi
│       ├── Diagnose.php       # Tanı
│       ├── DnsMasq.php        # DNS yönetimi
│       ├── Filesystem.php     # Dosya işlemleri
│       ├── PhpFpm.php         # PHP-FPM yönetimi
│       ├── Server.php         # İstek yönlendirme
│       ├── Site.php           # Site ve SSL yönetimi
│       ├── Status.php         # Sağlık kontrolleri
│       ├── Ngrok.php          # Ngrok tünel paylaşımı
│       ├── Expose.php         # Expose tünel paylaşımı
│       ├── Cloudflared.php    # Cloudflare tünel paylaşımı
│       └── Drivers/           # Framework driver'ları
│           ├── BerkanDriver.php
│           ├── LaravelBerkanDriver.php
│           └── Specific/      # 21 framework'e özel driver
└── tests/

Sorun Giderme

Web sunucu başlamıyor

Apache:

# Apache konfigürasyon sözdizimini kontrol et
sudo apachectl configtest

# Port 80 başkası tarafından kullanılıyor mu?
sudo lsof -i :80

# Apache hata logunu kontrol et
berkan log apache

Nginx:

# Nginx konfigürasyon sözdizimini kontrol et
sudo nginx -t

# Port 80 başkası tarafından kullanılıyor mu?
sudo lsof -i :80

# Nginx hata logunu kontrol et
berkan log nginx

Port çakışmaları

Port 80/443 başka bir servis tarafından kullanılıyorsa iki seçeneğiniz var:

  1. Özel portlar kullanın - berkan install komutunu tekrar çalıştırın ve alternatif portlar seçin (ör. 8080/8443). Portlar config.json'a kaydedilir ve tüm sunucu konfigürasyonları otomatik güncellenir.

  2. Varsayılan portları boşaltın - Çakışan servisi durdurun:

    # Port 80'i ne kullanıyor?
    sudo lsof -i :80
    
    # macOS dahili Apache'si çalışıyorsa durdurun
    sudo apachectl stop
    sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist 2>/dev/null

Özel portlar kullanırken sitelerinize port numarasıyla erişin: http://myapp.test:8080 veya https://myapp.test:8443.

Siteler çözümlenmiyor

# DNS çözümlemesini kontrol et
dig myapp.test @127.0.0.1

# Resolver dosyasının varlığını doğrula
cat /etc/resolver/test

# DnsMasq'i yeniden başlat
sudo brew services restart dnsmasq

# macOS DNS önbelleğini temizle
sudo dscacheutil -flushcache
sudo killall -HUP mDNSResponder

PHP-FPM soketi bulunamıyor

# Varsayılan soketin var olup olmadığını kontrol et
ls -la ~/.config/berkan/berkan.sock

# İzole soketleri kontrol et (ör. PHP 7.4)
ls -la ~/.config/berkan/berkan-7.4.sock

# PHP-FPM'i yeniden başlat
sudo brew services restart php

# Belirli bir izole PHP-FPM'i yeniden başlat
sudo brew services restart [email protected]

# PHP-FPM logunu kontrol et
berkan log php-fpm

HTTPS sertifikası güvenilir değil

# Siteyi yeniden güvenli hale getir
sudo berkan unsecure myapp
sudo berkan secure myapp

# Bir sertifikayı elle güvenilir yap
sudo security add-trusted-cert -d -r trustRoot \
  -k /Library/Keychains/System.keychain \
  ~/.config/berkan/Certificates/myapp.test.crt

Veritabanı başlamıyor

# Veritabanı durumunu kontrol et
berkan db:list

# Belirli bir veritabanını yeniden başlat
sudo berkan db:restart mysql

# Homebrew servis durumunu kontrol et
brew services list

Komple sıfırlama

# Tüm servisleri durdur
sudo berkan stop

# Kaldırma
sudo berkan uninstall --force

# Yeniden kur
sudo berkan install

Kaldırma

Yumuşak kaldırma (konfigürasyonu saklar)

sudo berkan uninstall

Tam kaldırma (her şeyi siler)

sudo berkan uninstall --force

Bu işlem şunları kaldırır:


Berkan - Built by Berkan Akman | MIT License


All versions of server with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/container Version ^10.0|^11.0|^12.0
illuminate/collections Version ^10.0|^11.0|^12.0
mnapoli/silly Version ^1.9
symfony/console Version ^6.0|^7.0
symfony/process Version ^6.0|^7.0
guzzlehttp/guzzle Version ^7.0
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 berkan/server contains the following files

Loading the files please wait ...