xy2z / capro Goto Github PK
View Code? Open in Web Editor NEWPHP8 static site generator
License: MIT License
PHP8 static site generator
License: MIT License
For checking if the current view is a collection or a page...
Eg. $self->is_collection('posts')
, is_page()
, or something... should also work for View Templates.
Now that it's using phar, it doesn't autoload the client's vendor/autoload.php anylonger, which doesn't work if you are using eg. Guzzle in the config files, then you have to manually require the autoload.php file. So do this automatically.
something like:
if file exists ( getcwd() /vendor/autoload.php
-> require_once getcwd() /vendor/autoload.php
might need to be disabled for the capro-dev itself, so it doesn't double load autoload.php file
so you can do Capro::...->count()
instead of count(Capro::....->get();
λ capro serve
PHP Fatal error: Cannot redeclare get_cats() (previously declared in .\capro-docs\config\core.php:5) in .\capro-docs\config\core.php on line 5
» Capro development server started at http://127.0.0.1:82
Temporary fix, use if (!function_exists('foo')) {
before each function...
If anyone has any idea on how to fix this, it's greatly appreciated :)
🎃 For more PHP hacktoberfest issues, see:
https://github.com/search?q=owner%3Axy2z+label%3Ahacktoberfest+is%3Aopen&type=issues&s=comments&o=asc
just like the 'build' command already does.
Right now capro serve
will tell you it's running even if you specify a busy port. It would be nice to check if the port is "free" before starting, and then throw an error if port is busy.
This is a really basic issue, but the default template used has got a missing closing </div>
- opened directly after the body tag as <div class="app">
.
I know this is really basic, but I haven't found any actual issues yet and I want to do my part as a good OSS citizen :)
It got super slow, especially the build process which now takes around 15 seconds 😴
But also the other commands are slow and takes a second eg capro -v
Seems to work fine in the global capro, but when it's inside a project dir, eg. capro-docs, using capro
or vendor/bin/capro
it's slooow....
So it doesn't return paths like /../../public/example/index.html
Since composer global "installs" won't always work because of dependency issues, it would be nice to have a phar file to work as the "global" capro binary.
Look into if it can be build automatically on each new release.
After this a capro self-update
would be nice, atleast for the phar.
Example could be "views/pages/.template.blade.php" - but should work for all subfolders of "views" folder.
Nice to have.
It can be useful to set view's yaml-front-matter to variables from config/.env file.
eg. to disable build on production (for drafts)
core.disable_build: ${{ config('app.is_production') }}
Probably best to use the same replacement as github action does ${{ like.this }}
- as others are using this so this is what people are used to. The eval the content as raw php, so it can be used for config, env, and other things, eg. ${{ env('foo') }}
.
If you run capro config app.domain
it works as expected.
But if you want to print the complete "app" array (config/app.yml
file) - it just prints empty array:
λ capro config app
Array
(
[app] =>
)
Even though it contains many items...
It might be the LiteConfig package that needs to be updated?
Make phpunit tests for all methods in the Collector class.
I already began a bit in tests\CollectorTest.php
You can see all methods that needs test in src\Collector.php
You can run the phpunit test by calling vendor\bin\phpunit tests --testdox
Please ask if you have any questions
🎃 For more PHP hacktoberfest issues, see:
https://github.com/search?q=owner%3Axy2z+label%3Ahacktoberfest+is%3Aopen&type=issues&s=comments&o=asc
I'm hoping to get some community testing before the stable release.
Everyone is welcome to test!
Would be nice to get at least 2-3 testers for each OS. I have tested it on Windows 10 and Ubuntu Server, so it should work on most stuff, but would be nice to get some reports from others :)
When these are done, and all the alpha issues in the Alpha milestone, a stable version can be released.
composer global require xy2z/capro:@alpha
capro new <name>
cd <name>
+ php -S localhost:82
views/pages/index.blade.php
and run capro build
(in the project root dir)capro build
and test the config variable is changed in the HTML file.capro build
- and validate the file is added to the public directory.Extended testing
Please comment below your test results, including OS version, PHP version and Capro version. And if you had any issues please include the logs. Thanks! 👍
Try to look into how laravel does their "artisan serve" - they also use Symfony Process it seems.
https://github.com/laravel/framework/blob/10.x/src/Illuminate/Foundation/Console/ServeCommand.php
When using composer's global "capro serve" command (instead of vendor/bin/capros serve") the terminal is bugging out after the serve is done... It's super weird but probably something to do with the "passthru()" command the global package uses to send it down to the projects capro package...
Maybe it would be nice to add functions many already know from Symfony and Laravel. the dd()
and dump()
function...
Could be useful for working with API's when you need to debug...
Eg. a magic method __call()
- try to call the custom class/method with $this->data
as argument.
Or set the CustomCollector class via the core config, so it points to eg. CustomCollector::class, which should be extended of Capro's Collector class.
It should still return $this, well maybe not necessarily, as it could also be like a sum() method, so probably let it be mixed.
Create a github action workflow that runs phpstan on all commits to any branch, and all PR's.
🎃 For more PHP hacktoberfest issues, see:
https://github.com/search?q=owner%3Axy2z+label%3Ahacktoberfest+is%3Aopen&type=issues&s=comments&o=asc
eg. when views dir, public dir and cache dir does not exist, it should validate for that and print a "capro" error.
I was looking at this project and it looks really interesting for me being a Laravel developer previously. I didn't saw this in the documentation but was curious if it supported pagination for collection pages?
https://www.php.net/manual/en/language.operators.comparison.php
Example:
Capro::pages()->where('weight', '>=', 200)->get();
But also it could use a param to use case sensitive or not, so think that in maybe :)
The current default is index.html, but it would be nice to save to other files eg .json, .atom or .xml, eg for RSS/Atom feeds.
Maybe make it possible to have a save_as
variable in the yaml front matter.
eg: save_as = feed.atom
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.