定制 tekwork/skeleton 二次开发

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

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

tekwork/skeleton

最新稳定版本:v1.0.0

Composer 安装命令:

composer create-project tekwork/skeleton

包简介

Skeleton application for Tekwork PHP MVC Framework

README 文档

README

Application squelette pour démarrer rapidement avec le framework PHP MVC Tekwork.

PHP Version Framework Version License

🚀 Installation rapide

composer create-project tekwork/skeleton mon-projet
cd mon-projet

C'est tout ! Votre projet est prêt. 🎉

📁 Structure du projet

mon-projet/
├── app/
│   ├── Controllers/         # Vos contrôleurs
│   │   └── HomeController.php
│   ├── views/               # Vos templates
│   │   ├── layout.php       # Layout principal
│   │   ├── home.php         # Page d'accueil
│   │   └── errors/          # Pages d'erreur (404, 500)
│   └── bootstrap.php        # Configuration des routes
├── public/
│   └── index.php            # Point d'entrée
├── log/                     # Fichiers de logs
├── vendor/                  # Dépendances (auto-généré)
├── config.example.php       # Template de configuration
├── config.php               # Configuration (créé automatiquement)
└── composer.json

⚙️ Configuration

Le fichier config.php est créé automatiquement lors de l'installation depuis config.example.php.

return [
    'debug' => true,  // ⚠️ false en production !
    'error_views_path' => path_it(ROOT, 'app', 'views', 'errors'),
    'log_path' => path_it(ROOT, 'log', 'app_errors.log'),
];

Important : config.php n'est PAS versionné (dans .gitignore).

🌐 Configuration serveur web

Nginx

server {
    listen 80;
    server_name mon-projet.local;
    root /chemin/vers/mon-projet/public;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}

Apache

Le fichier .htaccess est déjà configuré dans /public :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]

📝 Premiers pas

1. Ajouter une route

Dans app/bootstrap.php :

use Tekwork\Road;
use Tekwork\SecurityPatterns;

// Route avec paramètre
$router->add(
    (new Road('article/{:slug}', 'App\Controllers@ArticleController:show', 'article.show'))
        ->rule('slug', SecurityPatterns::SLUG)
);

2. Créer un contrôleur

Dans app/Controllers/ArticleController.php :

<?php
namespace App\Controllers;

use Tekwork\Controller;
use Tekwork\View;

class ArticleController extends Controller
{
    public function show(): void
    {
        $slug = $this->params['slug'];

        $view = new View(path_it(ROOT, 'app', 'views', 'article.php'));
        $view->add_vars(['slug' => $slug]);

        echo $this->render(path_it(ROOT, 'app', 'views', 'layout.php'), $view);
    }
}

3. Créer une vue

Dans app/views/article.php :

<article>
    <h1>Article : <?= htmlspecialchars($slug) ?></h1>
    <p>Contenu de l'article...</p>
</article>

🎨 Personnaliser les pages d'erreur

Éditez les fichiers dans app/views/errors/ :

  • 404.php - Page non trouvée
  • 500.php - Erreur serveur

Ces pages sont automatiquement affichées en mode production (debug = false).

🔒 Sécurité

Checklist avant production

  • Mettre debug = false dans config.php
  • Vérifier que config.php est dans .gitignore
  • Configurer les logs (log_path)
  • Échapper toutes les sorties : htmlspecialchars($var)
  • Utiliser HTTPS
  • Valider les inputs utilisateur

Consultez SECURITY.md du framework pour plus de détails.

📚 Documentation

🤝 Support

  • Issues : GitHub Issues
  • Questions : Ouvrez une issue avec le tag question

📄 Licence

Ce projet est sous licence MIT. Voir LICENSE pour plus de détails.

Le framework Tekwork est également sous licence MIT.

Bon développement ! 🚀

Propulsé par Tekwork Framework

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-12