Giter VIP home page Giter VIP logo

sae-wdd919's Introduction

PHP Basics - WDD919

Dieses README enhält einige Infos zu dieser Repository, nützliche Links und andere Infos, die sich in den letzten Unterrichten als hilfreich erwiesen haben. Ich werde versuchen die Datei aktuell zu halten und mit weiteren Infos zu füllen.

Text Editor

Ihr braucht für den Unterricht einen Text-Editor. Im Prinzip könnt ihr jeden beliebigen Plaintext Editor verwenden. Ich bin persönlich bin ein großer Fan von PhpStorm. Als SAE Studenten kriegt ihr das gesamte Programm Angebot vom Hersteller JetBrains, also auch PhpStorm kostenlos als Student Version. Nähere Infos auf der Hersteller Website: https://www.jetbrains.com/community/education/#students

docker-compose

Wer gerne Docker/Docker Compose nutzen möchte, findet ein entsprechendes File im Repository. Ihr könnte aber genauso gut auch den XAMPP/MAMP/whatever verwenden. Wichtig bei der Verwendung des hier befindlichen docker-compose.yml Files ist, dass ihr das .env.example File kopiert und damit ein .env File anlegt. Dieses .env File wird nicht von GIT in das Repository hinzugefügt und erlaubt auf allen Rechnern, auf denen ihr diese Docker-Umgebung startet, eine andere Konfiguration.

Web

  • Apache: localhost:8080
  • PhpMyAdmin: localhost:8081

Database

  • MariaDB: localhost:3306

Composer

Das MVC verwendet Composer. Wir haben die Bibliothek MPDF mittels Composer installiert. Um alle Abhängigkeiten nach dem Pull zu installieren führe im Terminal im Ordner mvc den Befehl php composer.phar install aus. Danach sollte ein Ordner angelegt werden mit dem Namen vendor und mehreren Inhalten. Bis dahin funktioniert das MVC möglicherweise nicht mehr.

Nützliche Informationen & Links

Cheatsheets

Alternative relationale Datenbanksysteme

Snippets

/**
 * $link holds the DB connection object created by mysqli_connect()
 */
$result = mysqli_query($link, "SELECT ...");

while ($row = mysqli_fetch_assoc($result)) {
    // do something with the current $row
}
/**
 * Die extract Funktion macht im Hintergrund folgendes:
 *
 * $id = $row['id'];
 * $title = $row['title'];
 * usw.
 */
extract($row);
-- MySQL Query, um alle bestellten Produkte aus dem JSON in der `orders` Tabelle auszulesen
SELECT id,
       user_id,
       JSON_EXTRACT(products, "$[*].id") as ordered_products
    FROM orders
    WHERE user_id = 1
    GROUP BY ordered_products

Misc

  • Manche Verzeichnisse in diesem Repository werden ein .gitkeep file beinhalten und sonst nichts. Das liegt daran, dass GIT leere Verzeichnisse nicht versioniert, ich möchte euch aber unter Umständen schon ein paar Ordner vorbereiten, in die später einmal etwas rein kommen wird.

Virtual Hosts / vhosts

Normalerweise sind Dateien im Apache Webserver nur über den Pfad erreichbar:


localhost/datei.php --> /var/www/html/datei.php domain.tld/datei.php --> /var/www/html/datei.php

localhost/php/index.php --> /var/www/html/php/index.php localhost/mvc/index.php --> /var/www/html/mvc/index.php
localhost/project3/index.php --> /var/www/html/project3/index.php

Sollen Dateien über eine Subdomain erreichbar sein, müssen virtuelle Hosts konfiguriert werden:


php.localhost/index.php --> /var/www/html/php/index.php mvc.localhost/index.php --> /var/www/html/mvc/index.php
project3.localhost/index.php --> /var/www/html/project3/index.php

localhost/php_workspace/Aufgabe/1/index.php --> /Application/MAMP/htdocs/php_workspace/Aufgabe/1/index.php
php_workspace.localhost/Aufgabe/1/index.php --> /Application/MAMP/htdocs/php_workspace/Aufgabe/1/index.php

sae-wdd919's People

Contributors

derhofbauer avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.