XAPPCORE DOCUMENTATION
| Product Owners | |
|---|---|
| Dev Type | Main |
| Statu | Live |
| Version | v0.1 |
-
KURULUM
PHP Versiyon : 7.0+
Dosyaları sunucunuza yükleyerek başlayabilirsiniz.
-
cores/Config.php Ayarları
define('URL', 'localhost'); // Web Site Adresiniz. define('theme', 'xapp'); // src/public içinde oluşturulan aktif olan tema adı. define('SUBFOLDER', false);// Sunucuda ana dizinde değilse true yapılması gerek. define('LOCALSERVER', true); //local (xServer, xampp, wamp) gibi sunucularda çalışıyorsanız true olması gerekir.define('STATICS', ["assets" => ""]); //Sürekli tekrarlanan URLleri daha kısa tutabiliriz. Örneğin: CDN sistemine sonra geçilebilir bu yüzden assets diye sabit oluşturulur ve link istenildiği zaman değişir.define('CORESTATUS', ["PUBLIC" => 1, "APP" => 1]); /* 1 Aktif, 0 Pasif PUBLIC => 0 ( src/public/temaName/controller/corestatus.php Yoksa 404.php) APP => 0 ( src/app/appName/controller/corestatus.php Yoksa 404.php) corestatus.php => CORESTATUS["PUBLIC"] olarak durumunu alabilirsiniz ve kendi sayfanızı oluşturabilirsiniz. Örn: 2 => Bakım Sayfası */
-
cores/Database.php
$config = [ 'dbMain' => [ 'host' => 'localhost', 'user' => '', 'pass' => '', 'db' => '' ], 'dbMessage' => [ 'host' => 'localhost', 'user' => '', 'pass' => '', 'db' => '' ] ]; $dbMain = CONNECTION('dbMain',$config); $db2 = CONNECTION('dbMessage',$config); /* $config array içinde dilediğiniz kadar veritabanı bilgisi saklıyabilirsiniz. Veritabanını aktif edebilmek için; $dbMain = CONNECTION('dbMain',$config); gibi kurabilirsiniz. NOT: Veritabanını projenizde kullanabilmek için; global $dbMain; yazmanız yeterlidir. Örnek Kullanım; global $dbMain; $data = $dbMain->prepare("SELECT * FROM dbTable"); $data->execute(); */
-
-
XAPPCORE KONSOL
localhost/cli/index.php
Main Project; >> New PUBLIC = createpublic name => (name: new public name) >> New APP = createapp name,theme => (name: new app name, theme: live public folder) >> APP List = applist >> PUBLIC List = publiclist Sub Project; >> New Sub Project = createsubproject subNAME >> New Sub APP = createsubapp subNAME,Name,Theme >> New Sub PUBLIC = createsubpublic subNAME,Name
-
Classes
-
Core
-
Cookie
Cookie Create ⇒
Cookie::Create("CookieName","CookieValue",DAY);Cookie Delete ⇒
Cookie::Delete('CookieName');Cookie View ⇒
Cookie::View('CookieName');//Kullanımı: use Core\Cookie; Cookie::View('CookieName');
-
Crypto
use Core\Crypto; $data = "https://mtrolab.com"; $chiper = "AES-128-CBC"; $key = "1234"; $crypto = new Crypto($chiper,$key); echo $crypto->Encrypt($data); print_r($crypto->Decrypt("GTMt22IZikvst5BuuGqnlnYUUl4iGfa2XWio0yw6gr8="));
-
Csrf
Csrf::Create()⇒ Csrf Kodunun oluşmasını sağlayan fonksiyonCsrf::View()⇒ Csrf kodunun gözükmesini sağlarCsrf::Verify($value)⇒ Csrfleri kontrol edilmesini sağlarCsrf::Input()⇒ Bu Kod ile otomatik csrf kodu oluşturur name: csrf olur.//Kullanımı: use Core\Csrf; Csrf::Create();
-
Database
use Core\DB; global $dbMain; $DB = new DB($dbMain);Query
$DB->query(["SELECT * FROM USERS",[]]);INSERT
$DB->INSERT( ['users', 'username =? ,password=?,email=?,createTime=?', ['test', 'testpaas', 'test@test.com', time()]]);UPDATE
$DB->UPDATE(['users','username = ? WHERE uID =?',['testUP',14]]);DELETE
$DB->DELETE(['users','username = ?',['test1']]);SELECT
$DB->SELECT(['*','users',[]]);SELECT → Lists
$DB->rowList($DB->SELECT(['*', 'users', []]),'ALL')
-
Auth
use Core\Auth;Register
Auth::Register(['csrf'=>Csrf(), 'email' => "test@test.com", 'password' => "test", 'trypassword' = "test"]) //Result(["code" => "error", "alert" => ["Registration Failed!", "", "error", ""]]); /* Geri dönen veriyi json decode ederek alert verilerine ulaşıp kullanıcıya alert verebilirsiniz. */Login
Auth::Login(['csrf'=>Csrf(), 'email' => "test@test.com", 'password' => "test"])Auth Verify
Auth::AuthVerify(); // Giriş session kontrolüAuth Control
AuthControl() // Giriş yapıldı ise kullanıcının bilgilerini geri döndürür.
-
-
Components
-
Model
use Components\Model; Model::App("index"); Model::Public("index");
-
Control
use Components\Control; Control::App("index"); Control::Public("index");
-
View
use Components\View; View::App("index"); View::Public("index");
-
-
AppTools
-
Page
use AppTools\Page; $arr = [ "query" => [ "rowCount" => ["*", "transactions", []], "rowList" => ['* ', 'transactions ORDER BY id DESC LIMIT ?,?', []] ], "options" => [ "Router" => _GET(2), "UrlRouter" => _PANELURL(_GET(1) . '/'), "Limit" => 10, "Error" => "You have no transactions!"] ]; $DataResult = Page::Lists($arr); foreach ($DataResult["Result"] as $item) { //TransactionView('wallet/img/logo.png', $item->toAddress, "Send", '-' . $item->amount, 'color:red;'); } Page::Pagination($DataResult["Pagination"]);
-
RequestJS
RequestJS::JS("PopUp üzerinde gözükecek bildirim!","URL")=>Bu fonksiyonu kullanarak yeni bir js fonksiyonu oluşturur.RequestJS::Encode($Data)=> Veriyi şifreler ve veri aktarımı sırasında içerik güvenliği sağlanır.RequestJS::Decode($Data)=> Verinin şifresini çözer.Örnek Kullanım:
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js" integrity="sha512-894YE6QWD5I59HgZOGReFYm4dnWc1Qt5NtvYSaNcOP+u1T9qYdvdihz0PPSiiqn/+/3e7Jo4EaG7TubfWGUrMQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script> <button id="asd">Click</button> <?php use AppTools\RequestJS; RequestJS::JS("Talep Göndermek İstermisiniz?", "/proc"); echo RequestJS::Encode("ONUR"); echo RequestJS::Decode("FHKpXzyXQ28ZyqdUNbX+dw=="); ?> <script> document.getElementById("asd").addEventListener('click', function(){ requestJS("asd"); }); </script>proc.php
<?php echo json_encode(["Name" => "Okey", "Desc" => "", "Statu" => "error", "Href" => "http://www.localhost/proc"]);
-
Upload
HTML FORM OLUŞTURMA
→Tek Dosya Yükleme
<form action="" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload" id="fileToUpload"> <input type="submit" value="Upload Image" name="submit"> </form>→Çoklu Dosya Yükleme
<form action="" method="post" enctype="multipart/form-data"> Select image to upload: <input type="file" name="fileToUpload[]" id="fileToUpload" multiple> <input type="submit" value="Upload Image" name="submit"> </form>PHP KOD KULLANIMI
Tek Dosya Yükleme
Fonksiyon Kullanımı:
Upload::Single('FORM INPUT NAME',Geçerli Uzantılar [ARRAY],'Dosya Adı',"İsteğe Bağlı Dosya Yer",İstede Bağlı Dosya Boyutu)Örnek:
print_r(Upload::Single("fileToUpload", ['jpg', 'png', 'gif'], "newName", "../../../"));Çoklu Dosya Yükleme
$return = Upload::Multi('fileToUpload', ['jpg', 'png', 'gif'], rand(1, 100),"../../../"); //Yüklenen resimlerin durumunu döndürür! foreach ($return as $item){ if ($item[0] == 1){ echo "Yüklendi => ".$item[1]; }else{ echo "Error => ".$item[1]; } }RETURN : ARRAY Olarak Geri Dönüş Yapar.
Başarılı ⇒ [0 ⇒ Durum, 1⇒ File Name ve Uzantısı]
Başarısız ⇒ [0 ⇒ Durum, 1⇒ Hata Açıklama]
Hata Komutları:
0 ⇒ File Error
1 ⇒ Success
2 ⇒ File Extension Not Available
3 ⇒ File Size Large
Veri Tabanına Kaydetmek İçin:
if ($fileReturn[0] == 1) { //VeriTabanı İşlemi Yapılır => $fileReturn[1] }
-
Lang
-
-
Template
-
HTML
use Template\Html; Html::Tag("img",["src"=>"https://www.w3schools.com/images/colorpicker2000.png"]); Html::CSS("asd"); Html::JS("abbb");
-
-
-
Helpers
-
Method
—>Veri Alma Ve Gönderme Methodları
$_POST ⇒ POST('NAME');
$_GET ⇒ GET('NAME');
$_SERVER ⇒ SERVER('REQUEST_METHOD'); OR SERVER();
$_SERVER['REQUEST_METHOD'] ⇒ REQUEST();
→FRAMEWORK'E Özel Veri Alma Methodları
route ⇒ _GET(INDEX) ⇒ USING: _GET(1) ⇒
URL üzerinden indexleme yapar http://mtrolab.com/wms
_GET(0) ⇒ OUTPUT: wms
-
Alert
Alerts($name,$statu,$desc,$href)($href ⇒ eğer link varsa işlemden sonra yönlendirme yaplacak)⇒sweetalertalert($alert);⇒ JS ALERT
-
Path
APP ⇒
_PANELURL()⇒URL. '/' .panelName. '/' . $pathPUBLIC⇒
PANELURL()⇒URL. '/' . $pathassetPATH("lll")=> src/assets altındaki klasöre tema dosyalarını koymak projenin derli toplu olmasını hedeflemektir. assets olarak sub domain oluşturulup config üzerinden assetCDN üzerine link olarak daha kullanışlı olacaktır.
-
Locations
→APP
_Href($url, $times = 0)→PUBLIC
Href($url, $times = 0)
-
Security
-
ENCODE
BASE64($DATA, ED=>Encode, 1=>Decode)
-
CRYPTO
PHash("Şifrelencek Data")
-
-
Image Convert
Webp Convert System
Kullanımı:
convertImageToWebP(Resim Yolu, "OluşturulacakResimAdı.webp", $quality = 80);Örnek:
convertImageToWebP(__DIR__ . '/img.jpg', "aa.webp", $quality = 80);IMG URI Convert
IMGURI(PATH)=> Image dosyasını URL de kulllanımasını sağlar
-
Validation
-
-
Packets
Hazır modül paketlerini tek bir yerde toplamak için yapılmıştır.
Örneğin;
iyzico entegrasyonu yapılacak.
composer require iyzico/iyzipay-php
- Packets içine iyzico klasörü oluştur.
- iyzico klasörü içine composer edilmiş halini atın.
- load.php oluşturun ve
require_once('vendor/autoload.php');projeyi dahil edelim.
Sistem otomatik bir şekilde load.php üzerinden projenize dahil edecektir.
-
XAAP CORE YAPISI
→CLI
→Cores
→Classes
→Helper
→Packets
Config.php
Database.php
Init.php
→Src
→App
→Public