- PHP 97.1%
- HTML 2.1%
- Dockerfile 0.3%
- Hack 0.3%
- Shell 0.1%
- Other 0.1%
| smolweb | Add auth | |
| .gitignore | Remove php value for php.ini settings | |
| build.sh | fix build script | |
| DEVELOPMENT.md | alpha 1 | |
| docker-compose.yml | . | |
| Dockerfile | . | |
| hosted_by_codeberg_88x31.png | Add license and badge | |
| INSTALL.md | Fix install | |
| LICENSE | Add license and badge | |
| README.md | Add counter docs | |
| screenshot1.webp | add screenshot | |
SmolWeb
SmolWeb is a collection of tools to make it easier to build a website with plain PHP.
/smolweb/example/
Blog
/smolweb/blog
Url routes:
-
/smolweb/blog/rssReturns the rss feed based on data.json
Php:
require_once __DIR__ . '/smolweb/blog/blog.incl.php';
$html = SmolBlog::getHtml('2020年12月01日');
// => html string of the /smolweb/blog/2020-12-01.txt parsed as markdown.
$data = SmolBlog::data();
$firstTitle = $data->items[0]->title;
// => string used as the title in blog listings
Data:
-
/smolweb/_data/blog/Add blog posts here, in markdown, with the filename following this format:
2020年12月01日.txt -
/smolweb/_data/blog/data.jsonAdd the filename (without .txt) and title, so that it works with the rss generator
Image
/smolweb/img.php
Add full size images in /smolweb/img/myimg.jpg or png, then add ?sa=jpg&h=720 to the end in the html img src, img.php will resize the image and cache it.
Data:
To add or remove images add them here: /smolweb/_data/img/
Webring
/smolweb/ring
Use to build your personal web ring just like webmasters did in the 2000s.
Special thanks to iceconey14 for the inspiration from their github.com/iceconey14/phpringring
Url routes:
-
/smolweb/ring/list.phpReturns json list of id, url, title, icon
-
/smolweb/ring/next.php?id=1Redirects to the next url after id 1
-
/smolweb/ring/prev.php?id=1Redirects to the url before id 1
-
/smolweb/ring/random.phpRedirects to a random url
Data:
To add or change the list of urls edit the file /smolweb/_data/ring.csv
Counter
Count each visit to your webpage
Url routes:
-
/smolweb/counter/digital.phpReturns an svg of the counter and ups the counter as well.
Php:
require_once __DIR__ . '/smolweb/counter/counter.incl.php';
$n = SmolCounter::number();
// => current number
$n = SmolCounter::setNumber(2);
// => set number to 2
$n = SmolCounter::tick();
// => returns current number and saves it plus one
Data:
The counter is located at /smolweb/_data/counter.txt if it doesn't exist, it starts at 0.
Shop
/smolweb/shop
Make a small store front for people to purchase your stuff, uses Mollie as payment processor.
Url routes:
-
/smolweb/shop/purchase.phpMust be a POST request with the following form data:cart[0][id] cart[0][quantity] cart[1][id] cart[1][quantity] ... name email phone address_street address_city address_postcode address_country -
/smolweb/shop/cart.js.phpDepends on AlpineJS and the Persist Plugin
Reads all products and creates a cart list, with easy add to cart functionality
<script src="/smolweb/shop/cart.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/@alpinejs/persist@3.x.x/dist/cdn.min.js"></script> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
Php:
require_once __DIR__ . '/smolweb/shop/shop.incl.php';
$data = SmolShop::data();
$firstTitle = $data->products[0]->title;
// => string used as the title in product listings
Data:
-
/smolweb/_data/shop/shop.jsonSet prices, add remove products
-
/smolweb/_data/shop/order_mail_template.txtMarkdown template for emails to be sent
-
/smolweb/_data/shop/orders.csvSpreadsheet of orders
-
/smolweb/_data/shop/config.incl.phpAdd Mollie api credentials here if you want to use the shop, otherwise purchasing will error.
License
I Hate AI License