-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
158 additions
and
39 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,32 +19,77 @@ Website 🚀 <a href="https://contributte.org">contributte.org</a> | Contact | |
</p> | ||
|
||
<p align=center> | ||
<img src="https://api.microlink.io?url=https%3A%2F%2Fexamples.contributte.org%2Fdoctrine-skeleton%2F&overlay.browser=light&screenshot=true&meta=false&embed=screenshot.url"></img> | ||
<a href="https://examples.contributte.org/doctrine-skeleton/">examples.contributte.org/doctrine-skeleton/</a> | ||
</p> | ||
|
||
<p align=center> | ||
<img src="https://api.microlink.io?url=https%3A%2F%2Fexamples.contributte.org%2Fdoctrine-skeleton%2F&overlay.browser=light&screenshot=true&meta=false&embed=screenshot.url"/> | ||
</p> | ||
|
||
----- | ||
|
||
## Goal | ||
## Introduction | ||
|
||
Main goal is to provide easy-to-use starter-kit project for Nette developers. | ||
This is a simple application with basic setup of [Doctrine](https://www.doctrine-project.org/) and [Nette](https://nette.org/). | ||
|
||
## Demo | ||
To test this application, follow these steps: | ||
|
||
https://examples.contributte.org/doctrine-skeleton/ | ||
1. Create a new project. | ||
2. Install dependencies. | ||
3. Setup configuration. | ||
4. Run the application. | ||
|
||
## Installation | ||
|
||
You will need `PHP 8.3+` and [Composer](https://getcomposer.org/). | ||
You will need `PHP 8.3+` and [Composer](https://getcomposer.org/) and [Git](https://git-scm.com/) installed. | ||
|
||
Install this application using **Composer** or **Git**. | ||
|
||
**Composer** | ||
|
||
Create project using composer. | ||
|
||
```bash | ||
composer create-project -s dev contributte/doctrine-skeleton acme | ||
``` | ||
|
||
Now you have application installed. It's time to run it. | ||
**Git** | ||
|
||
```bash | ||
git clone [email protected]:contributte/doctrine-skeleton.git acme | ||
``` | ||
|
||
Now you have application installed. It's time to install dependencies. | ||
|
||
```bash | ||
cd acme | ||
composer install | ||
``` | ||
|
||
## Configuration | ||
|
||
This application uses 2 databases PostgreSQL and MariaDB. You have to configure them in `local.neon`. | ||
This is how default configuration looks like. | ||
|
||
```neon | ||
parameters: | ||
postgres: | ||
driver: pdo_pgsql | ||
host: 0.0.0.0 | ||
port: 5432 | ||
user: contributte | ||
password: contributte | ||
dbname: demopostgres | ||
mariadb: | ||
driver: mysqli | ||
host: 0.0.0.0 | ||
port: 3306 | ||
user: contributte | ||
password: contributte | ||
dbname: demomariadb | ||
``` | ||
|
||
## Startup | ||
## Development | ||
|
||
The easiest way is to use php built-in web server. | ||
|
||
|
@@ -55,27 +100,35 @@ php -S 0.0.0.0:8000 -t www | |
|
||
Then visit [http://localhost:8000](http://localhost:8000) in your browser. | ||
|
||
## Backend | ||
## Usage | ||
|
||
It's based on [Contributte](https://contributte.org/) packages. | ||
To setup this application properly, you have to execute migrations. | ||
|
||
- [`contributte/application`](https://github.com/contributte/application) | ||
- [`contributte/bootstrap`](https://github.com/contributte/bootstrap) | ||
- [`contributte/di`](https://github.com/contributte/di) | ||
- [`contributte/forms`](https://github.com/contributte/forms) | ||
- [`contributte/http`](https://github.com/contributte/http) | ||
- [`contributte/utils`](https://github.com/contributte/utils) | ||
- [`contributte/latte`](https://github.com/contributte/latte) | ||
- [`contributte/tracy`](https://github.com/contributte/tracy) | ||
1. For **PostgreSQL** database. | ||
|
||
- [`contributte/doctrine-dbal`](https://github.com/contributte/doctrine-dbal) | ||
- [`contributte/doctrine-orm`](https://github.com/contributte/doctrine-orm) | ||
- [`contributte/doctrine-annotations`](https://github.com/contributte/doctrine-annotations) | ||
- [`contributte/doctrine-cache`](https://github.com/contributte/doctrine-cache) | ||
- [`contributte/doctrine-migrations`](https://github.com/contributte/doctrine-migrations) | ||
- [`contributte/doctrine-fixtures`](https://github.com/contributte/doctrine-fixtures) | ||
```bash | ||
# run migrations | ||
NETTE__MIGRATION__DB=postgres NETTE__MIGRATION__MANAGER=default bin/console migrations:migrate | ||
|
||
## Development | ||
# or generate new migration | ||
#NETTE__MIGRATION__DB=postgres NETTE__MIGRATION__MANAGER=default bin/console migrations:diff | ||
``` | ||
|
||
2. For **MariaDB** database. | ||
|
||
```bash | ||
# run migrations | ||
NETTE__MIGRATION__DB=mariadb NETTE__MIGRATION__MANAGER=second bin/console migrations:migrate | ||
|
||
# or generate new migration | ||
#NETTE__MIGRATION__DB=mariadb NETTE__MIGRATION__MANAGER=second bin/console migrations:diff | ||
``` | ||
|
||
## Screenshots | ||
|
||
![](.docs/screenshot.png) | ||
|
||
## Maintenance | ||
|
||
See [how to contribute](https://contributte.org/contributing.html) to this package. | ||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DB\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20241212192036 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, username VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET UTF8'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('DROP TABLE `user`'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace DB\Migrations; | ||
|
||
use Doctrine\DBAL\Schema\Schema; | ||
use Doctrine\Migrations\AbstractMigration; | ||
|
||
/** | ||
* Auto-generated Migration: Please modify to your needs! | ||
*/ | ||
final class Version20241212173845 extends AbstractMigration | ||
{ | ||
public function getDescription(): string | ||
{ | ||
return ''; | ||
} | ||
|
||
public function up(Schema $schema): void | ||
{ | ||
// this up() migration is auto-generated, please modify it to your needs | ||
$this->addSql('CREATE TABLE "user" (id INT GENERATED BY DEFAULT AS IDENTITY NOT NULL, username VARCHAR(255) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, updated_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))'); | ||
} | ||
|
||
public function down(Schema $schema): void | ||
{ | ||
// this down() migration is auto-generated, please modify it to your needs | ||
$this->addSql('DROP TABLE "user"'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters