├── http └── sql.http ├── public ├── js │ └── alert.js ├── images │ ├── sea.jpg │ └── cover2.png └── css │ ├── style.css │ └── excel.table.css ├── src ├── config │ ├── elasticsearch.php │ ├── app.php │ ├── memcache.php │ ├── rabitmq.php │ ├── test.php │ ├── mail.php │ ├── viewcache.php │ ├── redis.php │ ├── pdo.php │ └── config.php ├── Application │ ├── Lang │ │ ├── en │ │ │ ├── home.php │ │ │ ├── captcha.php │ │ │ └── form.php │ │ ├── fr │ │ │ └── home.php │ │ └── tr │ │ │ ├── home.php │ │ │ ├── captcha.php │ │ │ └── form.php │ ├── Listeners │ │ ├── Exceptions │ │ │ ├── Exception.php │ │ │ └── ExceptionRouter.php │ │ └── Auth │ │ │ ├── AuthLogoutListener.php │ │ │ ├── AuthRegisterListener.php │ │ │ └── AuthLoginListener.php │ ├── Controllers │ │ ├── Other │ │ │ └── Abs.php │ │ ├── PrevNextTest.php │ │ ├── MyContainerTest.php │ │ ├── Nested │ │ │ └── NestedTestController.php │ │ ├── Pipes │ │ │ ├── PipeTest2.php │ │ │ ├── PipeTest1.php │ │ │ └── PipeTest3.php │ │ ├── TestOrm.php │ │ ├── Deneme.php │ │ └── ImageFormHandleAndResizeTest.php │ ├── Models │ │ ├── Objectable │ │ │ ├── UserName.php │ │ │ └── UserPassword.php │ │ ├── Products.php │ │ ├── Customers.php │ │ ├── Role.php │ │ ├── Phone.php │ │ └── Book.php │ ├── Shutdown │ │ ├── ExampleShutdownListener.php │ │ └── ShutdownListener.php │ ├── Elastic │ │ ├── Restaurant.php │ │ └── Museum.php │ ├── Mappers │ │ ├── ForExampleMapper.php │ │ └── UsersMapper.php │ ├── Policies │ │ ├── Policy.php │ │ └── BookPolicy.php │ ├── Filter │ │ ├── MyFilter.php │ │ └── PhoneFilter.php │ ├── Rules │ │ ├── RequiredRule.php │ │ ├── UserMustBeAdmin.php │ │ ├── RequiredNumericRule.php │ │ └── TcNoVerifyRule.php │ ├── Routervalidators │ │ ├── RouterParamIsNumeric.php │ │ └── Validator.php │ ├── Auth │ │ └── Admin.php │ ├── seeds │ │ ├── BooksSeed.php │ │ ├── Builder │ │ │ └── DatabaseSeeder.php │ │ ├── CustomersSeed.php │ │ └── UsersSeed.php │ ├── Middleware │ │ ├── NameMiddleware.php │ │ ├── RequestIdMustBeInteger.php │ │ ├── TestExample.php │ │ ├── AuthMiddleware.php │ │ ├── GlobalMiddleware.php │ │ ├── GuestMiddleware.php │ │ ├── ThrottleMiddleware.php │ │ └── CaptchaVerifyMiddleware.php │ ├── Responses │ │ └── ResponseCollectionUser.php │ ├── Queue │ │ ├── Deneme.php │ │ ├── ExampleQueue.php │ │ └── SendEmail.php │ ├── Observer │ │ └── UserObserver.php │ ├── Request │ │ └── TcNoVerifyRequest.php │ └── Mail │ │ ├── UserMail.php │ │ └── ExampleMailable.php ├── Route │ ├── nested │ │ └── example.php │ ├── custom_router_for_from_path.php │ ├── admin │ │ └── admin_test.php │ └── Authorize │ │ └── RouterAuthorizeExample.php ├── Views │ ├── include-test.blade.php │ ├── header.blade.php │ ├── footer.blade.php │ ├── deneme.blade.php │ ├── nested │ │ └── forexample.blade.php │ ├── layout │ │ └── master.blade.php │ ├── xsstest.blade.php │ └── auth.blade.php ├── Components │ ├── Http │ │ ├── SessionHandler.php │ │ ├── Http.php │ │ ├── Controller │ │ │ └── AbstractController.php │ │ ├── SingletonRequest.php │ │ ├── Validate │ │ │ ├── AbstractValidate.php │ │ │ ├── StringValidate.php │ │ │ ├── NumericValidate.php │ │ │ ├── DateValidate.php │ │ │ ├── EmailValidate.php │ │ │ ├── MaxValidate.php │ │ │ ├── MinValidate.php │ │ │ ├── RequiredValidate.php │ │ │ ├── ImageValidate.php │ │ │ └── OptionalImageValidate.php │ │ └── FileSize.php │ ├── Database │ │ ├── ModelObserve.php │ │ ├── Migration │ │ │ ├── CreateMigrationObject.php │ │ │ ├── MysqlType │ │ │ │ ├── SmallIntMigrationType.php │ │ │ │ ├── TinyintMigrationType.php │ │ │ │ ├── StringMigrationType.php │ │ │ │ ├── JsonMigrationType.php │ │ │ │ ├── IntegerMigrationType.php │ │ │ │ ├── LongTextMigrationType.php │ │ │ │ ├── DecimalMigrationType.php │ │ │ │ ├── TinyTextMigrationType.php │ │ │ │ ├── BigIntegerMigrationType.php │ │ │ │ ├── TextMigrationType.php │ │ │ │ ├── DateTimeMigrationType.php │ │ │ │ ├── MediumTextMigrationType.php │ │ │ │ └── BooleanMigrationType.php │ │ │ ├── Migration.php │ │ │ ├── CallMigrationObjects.php │ │ │ └── MigrationStorage.php │ │ ├── ObjectAbleProperty.php │ │ ├── ModelMacro.php │ │ ├── Traits │ │ │ └── MigrationDataTypeDestructTrait.php │ │ ├── ObserveStorage.php │ │ └── PDOAdaptor.php │ ├── Mail │ │ ├── AbstractMailable.php │ │ ├── SwiftMailer.php │ │ └── SmtpTransport.php │ ├── Exceptions │ │ ├── ArrayMustBeAssocException.php │ │ ├── RoleNotFoundException.php │ │ ├── PolicyNotFoundException.php │ │ ├── MasterPageNotFound.php │ │ ├── BladeFilterNotFoundException.php │ │ ├── ImageExtensionNotSupported.php │ │ ├── JsonEncodeException.php │ │ ├── RouterTypeException.php │ │ ├── ViewNotFoundException.php │ │ ├── MiddlewareNotFoundException.php │ │ ├── PermissionNotFoundException.php │ │ └── MethodNotfoundInModelException.php │ ├── Enums │ │ ├── CrsfEnum.php │ │ └── FormValidationEnum.php │ ├── Auth │ │ ├── Permission │ │ │ └── RolePermissions.php │ │ ├── User │ │ │ ├── Auth.php │ │ │ ├── Enums.php │ │ │ ├── Login.php │ │ │ ├── Register.php │ │ │ ├── Logout.php │ │ │ └── AuthEventListener.php │ │ ├── Hash │ │ │ └── Hash.php │ │ ├── Policy │ │ │ └── AbstractPolicy.php │ │ └── Listener.php │ ├── Queue │ │ ├── Stack.php │ │ ├── MessageQueuePublisher.php │ │ └── MessageQueueConnection.php │ ├── Cache │ │ ├── Clients.php │ │ ├── Redis │ │ │ ├── RedisClient.php │ │ │ ├── Event.php │ │ │ └── ViewRedisCache.php │ │ └── Memcache │ │ │ ├── ViewMemcached.php │ │ │ └── Memcache.php │ ├── Blade │ │ ├── Filter │ │ │ └── BladeFilters.php │ │ ├── BladeDirectiveInterface.php │ │ ├── CompressBlade.php │ │ ├── PhpDirective.php │ │ ├── CsrfDirective.php │ │ ├── ElseDirective.php │ │ ├── EndAuthDirective.php │ │ ├── EndForDirective.php │ │ ├── IfDirective.php │ │ ├── EndMobileDirective.php │ │ ├── AuthDirective.php │ │ ├── EndforeachDirective.php │ │ ├── JsEscapeDirective.php │ │ ├── MobileDirective.php │ │ ├── ElseIfDirective.php │ │ ├── CurlBracesAllowedHtmlChars.php │ │ ├── EndPhpDirective.php │ │ ├── EndifDirective.php │ │ ├── ForeachDirective.php │ │ ├── ForDirective.php │ │ ├── RemoveYields.php │ │ ├── IncludeDirective.php │ │ ├── CommentDirective.php │ │ ├── RemoveSectionDirective.php │ │ ├── CustomDirective.php │ │ └── ExtendsDirective.php │ ├── Route │ │ ├── NotFound.php │ │ ├── Validators │ │ │ ├── ValidateRouterParamInt.php │ │ │ ├── ValidateRouter.php │ │ │ ├── ValidateRouterParamDate.php │ │ │ ├── ValidateRouterParamString.php │ │ │ └── AbstractValidateRouter.php │ │ ├── CurrentRouter.php │ │ ├── Compare.php │ │ ├── RouterQueryString.php │ │ └── RouterStorage.php │ ├── Flash │ │ └── HtmlFormValuesStorage.php │ ├── Pipeline │ │ ├── PipeAble.php │ │ └── Pipeline.php │ ├── Elasticsearch │ │ ├── Elastic.php │ │ ├── ElasticCollection.php │ │ └── ModelMapper.php │ ├── Arr │ │ ├── Arr.php │ │ └── CanIterate.php │ ├── Shutdown │ │ └── App.php │ ├── Traits │ │ ├── Singleton.php │ │ └── ConditionAble.php │ ├── Container │ │ ├── App.php │ │ └── AppContainer.php │ ├── File │ │ └── Excel.php │ ├── ToString.php │ ├── NullObject.php │ ├── Cache.php │ ├── View │ │ └── Master.php │ ├── Reflection │ │ └── CodeBeautifier.php │ └── Message │ │ └── RedisMessageConsumer.php ├── Interfaces │ ├── ResponseCollectionInterface.php │ ├── RequestInterface.php │ ├── SeedInterface.php │ ├── ToJson.php │ ├── ArrayAble.php │ ├── AuthEventListener.php │ ├── RegisterShutdownInterface.php │ ├── RouterAuthorizeInterface.php │ ├── FormRequestInterface.php │ ├── BladeFilterInterface.php │ ├── PipeAble.php │ ├── Mailable.php │ ├── ValidateRouterInterface.php │ ├── MigrationInterface.php │ ├── RelationInterface.php │ ├── QueueInterface.php │ ├── HasRelationInterface.php │ ├── MiddlewareInterface.php │ ├── RuleInterface.php │ ├── ValidatorInterface.php │ ├── ViewCacheInterface.php │ ├── ValidateLengthInterface.php │ ├── CsrfGuardInterface.php │ ├── ProcessForkInterface.php │ ├── ModelObserverInterface.php │ ├── Autocomplete │ │ └── PolicyAutocomplete.php │ └── PolicyInterface.php ├── Bootstrap │ ├── Application.php │ ├── BeautifulError.php │ ├── Bootstrap.php │ ├── App.php │ └── GlobalMiddlewareLayer.php └── Providers │ ├── ProviderInterface.php │ ├── CustomDirectiveProvider.php │ ├── MasterPageProvider.php │ ├── SessionProvider.php │ ├── AliasProvider.php │ ├── ContainerProvider.php │ └── ServiceProvider.php ├── serve.sh ├── .htaccess ├── .gitignore ├── fixer.sh ├── watcher.sh ├── bin ├── Stubs │ ├── Controller │ ├── View │ ├── mapper │ ├── rule │ ├── blade.filter │ ├── request │ ├── middleware │ ├── command │ ├── Model │ ├── queue │ ├── policy │ ├── migration │ └── mail ├── console ├── Commands │ ├── SeedRunCommand.php │ ├── VersionCommand.php │ ├── DropTableFromMigrations.php │ ├── RedisMessageConsumerCommand.php │ ├── ErrorLogChangedCommand.php │ └── CustomCommand.php ├── Components │ ├── CommandInterface.php │ ├── Animation.php │ ├── Process │ │ ├── Async.php │ │ └── ExampleProcess.php │ └── Command.php └── Migrations │ ├── roles_migration_2020_07_07.php │ ├── user_permission_migration_2020_07_08_00:33.php │ ├── permissions_migration_2020_07_07.php │ ├── payments_migration_2020_06_08_04:48.php │ ├── user_roles_migration_2020_07_07.php │ ├── role_permissions_2020_07_07.php │ └── customer_migration_2020_06_5.php ├── git.add.sh ├── .env ├── console ├── phpunit.xml ├── .travis.yml ├── test ├── config │ └── ConfigReadTest.php ├── router │ ├── RouteListCommandTest.php │ └── RouterParameterTypeValidate.php ├── collection │ └── CollectionTest.php ├── middleware │ └── MiddlewareTest.php └── env │ └── ReadEnvTest.php ├── services.sh ├── SECURITY.md ├── .github └── FUNDING.yml ├── package.json ├── watcher.js └── index.php /http/sql.http: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/alert.js: -------------------------------------------------------------------------------- 1 | alert(document.URL); -------------------------------------------------------------------------------- /src/config/elasticsearch.php: -------------------------------------------------------------------------------- 1 | 'hello' 5 | ]; 6 | -------------------------------------------------------------------------------- /src/Application/Lang/fr/home.php: -------------------------------------------------------------------------------- 1 | 'salut' 5 | ]; 6 | -------------------------------------------------------------------------------- /src/Application/Lang/tr/home.php: -------------------------------------------------------------------------------- 1 | 'merhaba' 5 | ]; 6 | -------------------------------------------------------------------------------- /src/config/app.php: -------------------------------------------------------------------------------- 1 | 'tr_TR', 7 | ]; 8 | -------------------------------------------------------------------------------- /src/Route/nested/example.php: -------------------------------------------------------------------------------- 1 | __FUNCTION__); 3 | -------------------------------------------------------------------------------- /public/images/sea.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diloabininyeri/dilovel/HEAD/public/images/sea.jpg -------------------------------------------------------------------------------- /src/Views/include-test.blade.php: -------------------------------------------------------------------------------- 1 |

include test deneme yanılma olsun olmasın {{$name}}

2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | vendor 3 | src/Views/caches 4 | deneme.php 5 | node_modules 6 | .phpunit.result.cache -------------------------------------------------------------------------------- /public/images/cover2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diloabininyeri/dilovel/HEAD/public/images/cover2.png -------------------------------------------------------------------------------- /src/Route/custom_router_for_from_path.php: -------------------------------------------------------------------------------- 1 | 'for custom'); 4 | -------------------------------------------------------------------------------- /src/Application/Lang/en/captcha.php: -------------------------------------------------------------------------------- 1 | 'please check captcha verify' 5 | ]; 6 | -------------------------------------------------------------------------------- /src/config/memcache.php: -------------------------------------------------------------------------------- 1 | 'localhost', 7 | 'port'=>11211 8 | ]; 9 | -------------------------------------------------------------------------------- /src/Application/Lang/tr/captcha.php: -------------------------------------------------------------------------------- 1 | 'lütfen formdaki resmi doğrulayın' 5 | ]; 6 | -------------------------------------------------------------------------------- /src/Route/admin/admin_test.php: -------------------------------------------------------------------------------- 1 | 2 |
3 |
header area by {{$name}}
4 |
5 | 6 | -------------------------------------------------------------------------------- /fixer.sh: -------------------------------------------------------------------------------- 1 | php-cs-fixer fix . --rules=@PSR1 2 | php-cs-fixer fix . --rules=@PSR2 3 | php-cs-fixer fix . --rules=@PHP71Migration 4 | php-cs-fixer fix . --rules=@PHP73Migration -------------------------------------------------------------------------------- /src/Application/Listeners/Exceptions/ExceptionRouter.php: -------------------------------------------------------------------------------- 1 | 'localhost', 6 | 'port' => 5672, 7 | 'user' => 'guest', 8 | 'password' => 'guest', 9 | ]; 10 | -------------------------------------------------------------------------------- /watcher.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sudo apt install inotify-tools 3 | while inotifywait -e modify src/logs/error.log; do 4 | php console error:detected 5 | kdialog --msgbox "error log file changed" 6 | done -------------------------------------------------------------------------------- /src/Components/Auth/Permission/RolePermissions.php: -------------------------------------------------------------------------------- 1 | [ 10 | 11 | 'version' => 7.4 12 | ] 13 | ]; 14 | -------------------------------------------------------------------------------- /src/Components/Auth/User/Auth.php: -------------------------------------------------------------------------------- 1 | 'smtp.gmail.com', 6 | 'username'=>'your_mail@gmail.com', 7 | 'password'=>'your_password', 8 | 'port'=>587, 9 | 'encrypt'=>'tls' 10 | ]; 11 | -------------------------------------------------------------------------------- /bin/Stubs/Controller: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | footer area {{$signature}} 5 |
6 |
7 | 8 | -------------------------------------------------------------------------------- /src/Application/Models/Objectable/UserName.php: -------------------------------------------------------------------------------- 1 | run()); 12 | $printable->output(); 13 | -------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | run()); 12 | $printable->output(); 13 | -------------------------------------------------------------------------------- /phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ./test/ 6 | 7 | 8 | -------------------------------------------------------------------------------- /src/Interfaces/RequestInterface.php: -------------------------------------------------------------------------------- 1 | other section 4 | @include('include-test') 5 | @endsection 6 | 7 | @section('area') 8 |

area section test {{$name}}

9 | @endsection 10 | {{5+5}}
11 | {{5+1222}}
12 | @name($name) -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | os: 3 | - linux 4 | - osx 5 | - windows 6 | php: 7 | - '7.4' 8 | - hhvm # on Trusty only 9 | - nightly 10 | before_script: 11 | - composer install --ignore-platform-reqs 12 | script: 13 | - ./vendor/bin/phpunit 14 | notifications: 15 | email: false 16 | 17 | -------------------------------------------------------------------------------- /src/Components/Exceptions/JsonEncodeException.php: -------------------------------------------------------------------------------- 1 | assertEquals($version, 7.4); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /bin/Commands/SeedRunCommand.php: -------------------------------------------------------------------------------- 1 | 'redis', 9 | 'clients'=>[ 10 | 'memcache'=> ViewMemcached::class, 11 | 'redis'=> ViewRedisCache::class 12 | ] 13 | ]; 14 | -------------------------------------------------------------------------------- /src/Interfaces/RouterAuthorizeInterface.php: -------------------------------------------------------------------------------- 1 | property); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Bootstrap/Application.php: -------------------------------------------------------------------------------- 1 | Redis::class, 14 | 'memcache'=>Memcache::class 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/Http/Controller/AbstractController.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | title 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /bin/Stubs/mapper: -------------------------------------------------------------------------------- 1 | name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | 3 | overflow: hidden; 4 | background: #ecf0f1; 5 | } 6 | 7 | .container { 8 | width: 99%; 9 | height: 99vh; 10 | display: grid; 11 | place-content: center center; 12 | } 13 | 14 | .area{ 15 | color: #2980b9; 16 | padding: 1em; 17 | } 18 | 19 | .text-center { 20 | text-align: center; 21 | } 22 | a{ 23 | text-decoration: none; 24 | } -------------------------------------------------------------------------------- /src/Components/Blade/Filter/BladeFilters.php: -------------------------------------------------------------------------------- 1 | PhoneFilter::class, 14 | 'my_filter'=>MyFilter::class 15 | ]; 16 | } 17 | -------------------------------------------------------------------------------- /src/Components/Route/NotFound.php: -------------------------------------------------------------------------------- 1 | name; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Application/Policies/Policy.php: -------------------------------------------------------------------------------- 1 | BookPolicy::class 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /services.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #using service.sh start|restart|stop 3 | #start all of service service.sh start 4 | 5 | services=(mysql redis-server elasticsearch kibana memcached php-fpm) 6 | echo "$1"ing ..... 7 | for i in "${services[@]}"; 8 | do 9 | sleep 1 10 | if service --status-all | grep -Fq "$i"; then 11 | sudo service "$i" "$1" 12 | systemctl is-active --quiet "$i" && echo "$i" service is "$1"ed 13 | fi 14 | 15 | done 16 | -------------------------------------------------------------------------------- /src/Components/Flash/HtmlFormValuesStorage.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Components/Blade/BladeDirectiveInterface.php: -------------------------------------------------------------------------------- 1 | assertIsIterable($collection); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Application/Filter/MyFilter.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Document 9 | 10 | 11 | 12 |

for example nested view via dot notation

13 | 14 | 15 | -------------------------------------------------------------------------------- /bin/Commands/DropTableFromMigrations.php: -------------------------------------------------------------------------------- 1 | name, $this->surname); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Components/Pipeline/PipeAble.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Document 9 | 10 | 11 |

merhabaa

12 | @yield('other') 13 | @yield('area') 14 |

footer

15 | 16 | -------------------------------------------------------------------------------- /src/Views/xsstest.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Document 9 | 10 | 11 | 12 |

{{''}}

13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bin/Stubs/request: -------------------------------------------------------------------------------- 1 | post('tc_no')); 14 | } 15 | 16 | public function message(): string 17 | { 18 | return "pelase write some things"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Application/Rules/UserMustBeAdmin.php: -------------------------------------------------------------------------------- 1 | get('user') === 'admin'; 14 | } 15 | 16 | public function message(): string 17 | { 18 | return "user must be admin"; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Components/Elasticsearch/Elastic.php: -------------------------------------------------------------------------------- 1 | build(); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Components/Mail/SwiftMailer.php: -------------------------------------------------------------------------------- 1 | setConfigs()); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/config/redis.php: -------------------------------------------------------------------------------- 1 | '127.0.0.1', 6 | 'port' => 6379, 7 | 'database' => 15, 8 | 'alias' => 'first', 9 | ), 10 | array( 11 | 'host' => '127.0.0.1', 12 | 'port' => 6380, 13 | 'database' => 15, 14 | 'alias' => 'second', 15 | ), 16 | ); 17 | 18 | */ 19 | return [ 20 | 21 | 'host'=>env('REDIS_HOST', '127.0.0.1'), 22 | 'port'=>env('REDIS_PORT', 6379), 23 | 'database'=>2, 24 | 'alias'=>'hmvc' 25 | ]; 26 | -------------------------------------------------------------------------------- /src/Components/Arr/Arr.php: -------------------------------------------------------------------------------- 1 | clone $mapper($item), $array); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Application/Rules/RequiredNumericRule.php: -------------------------------------------------------------------------------- 1 | post('tc_no')); 14 | } 15 | 16 | public function message(): string 17 | { 18 | return 'tc no must be numeric'; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Interfaces/RuleInterface.php: -------------------------------------------------------------------------------- 1 | [ 9 | 'database' => 'hmvc', 10 | 'user' => 'admin', 11 | 'password' => 'admin', 12 | 'host' => 'localhost', 13 | 'driver' => 'mysql' 14 | ], 15 | 'role' => [ 16 | 'database' => 'roles', 17 | 'user' => 'admin', 18 | 'password' => 'admin', 19 | 'host' => 'localhost', 20 | 'driver' => 'mysql' 21 | ] 22 | ]; 23 | -------------------------------------------------------------------------------- /src/Application/Lang/en/form.php: -------------------------------------------------------------------------------- 1 | ':element must be string', 6 | 'email'=>':element must be email', 7 | 'numeric'=>':element must be numeric', 8 | 'date'=>':element must be string', 9 | 'required'=>':element is required', 10 | 'min'=>':element to short', 11 | 'max'=>':element to max', 12 | 'image'=>':element must be image', 13 | 'optional_image'=>':element must be image', 14 | 'jpg_image'=>':element type must be jpg or jpeg', 15 | ]; 16 | -------------------------------------------------------------------------------- /bin/Components/Process/Async.php: -------------------------------------------------------------------------------- 1 | runOneByOneClosure(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Application/Controllers/Pipes/PipeTest2.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 7 | 8 | Document 9 | 10 | 11 | 12 |

@lcfirst(strtoupper('merr')) grgegrrgeg

13 | @auth() 14 |

oturum sayfası

15 | @endauth 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Application/Elastic/Museum.php: -------------------------------------------------------------------------------- 1 | '; 19 | }); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Application/Routervalidators/RouterParamIsNumeric.php: -------------------------------------------------------------------------------- 1 | ValidateRouterParamInt::class, 19 | 'string' => ValidateRouterParamString::class, 20 | 'date' => ValidateRouterParamDate::class 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /src/Interfaces/ValidatorInterface.php: -------------------------------------------------------------------------------- 1 | addToQueue($message, $queueName); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/Route/Validators/ValidateRouterParamDate.php: -------------------------------------------------------------------------------- 1 | 'dılo sürücü']; 18 | }); 19 | 20 | 21 | Master::page('footer', function () { 22 | return ['signature'=>'hmvc php']; 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Application/Lang/tr/form.php: -------------------------------------------------------------------------------- 1 | ':element string olmalı ', 6 | 'email'=>':element geçersiz email adresi ', 7 | 'numeric'=>':element alanı mutlaka sayısal olmalı', 8 | 'date'=>':element alanı tarih olmalı', 9 | 'required'=>':element alanı gereklidir', 10 | 'min'=>':element alanı çok kısa', 11 | 'max'=>':element alanı çok uzun oldu', 12 | 'image'=>':element resim olmalıdır', 13 | 'optional_image'=>':element resim olmalıdır', 14 | 'jpg_image'=>':element türü jpg veya jpeg olmalı', 15 | ]; 16 | -------------------------------------------------------------------------------- /src/Components/Shutdown/App.php: -------------------------------------------------------------------------------- 1 | [ 13 | ServiceProvider::class, 14 | AliasProvider::class, 15 | SessionProvider::class, 16 | ContainerProvider::class, 17 | MasterPageProvider::class, 18 | CustomDirectiveProvider::class, 19 | ] 20 | ]; 21 | -------------------------------------------------------------------------------- /bin/Stubs/middleware: -------------------------------------------------------------------------------- 1 | pushHandler(new PrettyPageHandler); 24 | $whoops->register(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /bin/Commands/RedisMessageConsumerCommand.php: -------------------------------------------------------------------------------- 1 | $faker->domainName, 18 | 'user_id' =>$faker->randomDigit, 19 | ]); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Components/Blade/CompressBlade.php: -------------------------------------------------------------------------------- 1 | [response()->toJson(['data'=>[],'status'])]); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Elasticsearch/ElasticCollection.php: -------------------------------------------------------------------------------- 1 | last_login_at=now(); 22 | $user->save(); 23 | //redirect()->router('home'); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/Arr/CanIterate.php: -------------------------------------------------------------------------------- 1 | toArray()); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/Blade/PhpDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ' 5) { 23 | return $next; 24 | } 25 | return 'les then 5'; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Components/Blade/CsrfDirective.php: -------------------------------------------------------------------------------- 1 | generateToken()}}" name="'.$tokenName.'"/>', $template); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Application/Middleware/RequestIdMustBeInteger.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Interfaces/CsrfGuardInterface.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Blade/EndForDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Blade/IfDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($f) { 15 | return ''; 16 | }, $template); 17 | } 18 | 19 | /** 20 | * @inheritDoc 21 | */ 22 | public function getDirectiveRegexPattern() 23 | { 24 | return '/@if(.*)/'; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bin/Stubs/queue: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Blade/AuthDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($f) { 15 | return 'check()) :?>'; 16 | }, $template); 17 | } 18 | 19 | /** 20 | * @inheritDoc 21 | */ 22 | public function getDirectiveRegexPattern() 23 | { 24 | return '/@auth(.*)/'; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Route/Validators/ValidateRouterParamString.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Blade/JsEscapeDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 23 | return '{{' . $find[1] . '}}'; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Blade/MobileDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($f) { 14 | return 'isMobile()):?>'; 15 | }, $template); 16 | } 17 | 18 | /** 19 | * @inheritDoc 20 | */ 21 | public function getDirectiveRegexPattern() 22 | { 23 | return '/@mobile(.*)/'; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Components/Container/App.php: -------------------------------------------------------------------------------- 1 | true, 24 | 'user'=>$this->collection 25 | ]; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Components/Blade/ElseIfDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Application/Routervalidators/Validator.php: -------------------------------------------------------------------------------- 1 | RouterParamIsNumeric::class, 20 | ]; 21 | 22 | /** 23 | * @return array|string[] 24 | */ 25 | public function getTypes():array 26 | { 27 | return $this->validators; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Providers/AliasProvider.php: -------------------------------------------------------------------------------- 1 | set(Enums::USER_AUTH_SESSION_NAME, $user->getPrimaryKeyValue()); 17 | if ($session->get(Enums::USER_AUTH_SESSION_NAME)) { 18 | Listener::fire('login', $user); 19 | } 20 | return $session->exists(Enums::USER_AUTH_SESSION_NAME); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Components/Blade/CurlBracesAllowedHtmlChars.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 23 | return ''; 24 | }, $template); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /bin/Components/Command.php: -------------------------------------------------------------------------------- 1 | setObject(new Console()) 25 | ->setProperty('commands') 26 | ->getValue(); 27 | 28 | ksort($commands); 29 | return $commands; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Application/Middleware/TestExample.php: -------------------------------------------------------------------------------- 1 | merge(['id'=>63,'name'=>'urfa']); 26 | return $next($request); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/Queue/MessageQueueConnection.php: -------------------------------------------------------------------------------- 1 | getClassObjectFromFile($file); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Auth/User/Register.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 27 | return '; ?>'; 28 | }, $template); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Components/Blade/EndifDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function () { 26 | return ''; 27 | }, $template); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Components/Blade/ForeachDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 23 | print_r($find); 24 | return ''; 25 | }, $template); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Components/Database/ObjectAbleProperty.php: -------------------------------------------------------------------------------- 1 | property = $property; 24 | } 25 | 26 | /** 27 | * @return mixed 28 | * 29 | */ 30 | public function __toString() 31 | { 32 | return $this->property; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Application/Queue/Deneme.php: -------------------------------------------------------------------------------- 1 | post('tc_no') == 11); 23 | } 24 | 25 | /** 26 | * @return string 27 | */ 28 | public function message(): string 29 | { 30 | return 'tc not verified'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Components/Route/CurrentRouter.php: -------------------------------------------------------------------------------- 1 | name; 16 | $oldModel->name; 17 | } 18 | 19 | public function deleted(Model $model) 20 | { 21 | echo $model->name.' deleted'; 22 | } 23 | 24 | public function created(Model $model) 25 | { 26 | echo $model->name . ' cretaed'; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/Blade/ForDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 27 | return ''; 28 | }, $template); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /bin/Commands/CustomCommand.php: -------------------------------------------------------------------------------- 1 | register('deneme', static function () { 23 | return new MyContainerTest(); 24 | }); 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | public function boot(): void 31 | { 32 | Carbon::setLocale(config('app.locale')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Bootstrap/Bootstrap.php: -------------------------------------------------------------------------------- 1 | register(); 30 | $provider->boot(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Components/File/Excel.php: -------------------------------------------------------------------------------- 1 | $faker->name, 21 | 'city_id' =>random_int(1, 82), 22 | 'about'=>$faker->paragraph 23 | ]); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Application/seeds/UsersSeed.php: -------------------------------------------------------------------------------- 1 | $faker->firstName, 19 | 'password' => Hash::make(123456), 20 | 'surname' => $faker->lastName, 21 | 'country' => 90, 22 | 'email' => $faker->email, 23 | ]); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Components/Route/Compare.php: -------------------------------------------------------------------------------- 1 | mainRouter = $mainRouter; 25 | return $this; 26 | } 27 | 28 | /** 29 | * @return bool 30 | */ 31 | public function isEqual(): bool 32 | { 33 | return $this->mainRouter->getUrlPath() === $this->mainRouter->getDynamicUrl(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Application/Middleware/AuthMiddleware.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return $next($request); 27 | } 28 | return abort('errors.404'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Components/Auth/Hash/Hash.php: -------------------------------------------------------------------------------- 1 | 12, 21 | ]; 22 | return password_hash($password, PASSWORD_BCRYPT, $options); 23 | } 24 | 25 | 26 | /** 27 | * @param $password 28 | * @param $hash 29 | * @return bool 30 | */ 31 | public static function check($password, $hash): bool 32 | { 33 | return password_verify($password, $hash); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hmvc", 3 | "version": "1.0.0", 4 | "description": "log watcher", 5 | "main": "wather.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/diloabininyeri/hmvc.git" 15 | }, 16 | "keywords": [ 17 | "error.log", 18 | "watcher" 19 | ], 20 | "author": "dılo sürücü ", 21 | "license": "ISC", 22 | "bugs": { 23 | "url": "https://github.com/diloabininyeri/hmvc/issues" 24 | }, 25 | "homepage": "https://github.com/diloabininyeri/hmvc#readme", 26 | "dependencies": { 27 | "log-timestamp": "^0.3.0" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /watcher.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const {exec} = require("child_process"); 3 | require('log-timestamp'); 4 | 5 | const logFile = './src/logs/error.log'; 6 | const command='php console error:detected'; 7 | 8 | console.log(`Watching for file changes on ${logFile}`); 9 | 10 | fs.watchFile(logFile, () => { 11 | 12 | console.log(`${logFile} file Changed`); 13 | 14 | exec(command, (error, stdout, stderr) => { 15 | if (error) { 16 | console.log(`error: ${error.message}`); 17 | return; 18 | } 19 | if (stderr) { 20 | console.log(`stderr: ${stderr}`); 21 | return; 22 | } 23 | console.log(`stdout: ${stdout}`); 24 | }); 25 | 26 | 27 | }); 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Bootstrap/App.php: -------------------------------------------------------------------------------- 1 | run() 21 | ->loadRouterWeb() 22 | ->startUp(); 23 | 24 | return $this; 25 | } 26 | 27 | /** 28 | * @return string|null 29 | */ 30 | public function call404IfNotFound():?string 31 | { 32 | if (NotFound::isCannotFindAny()) { 33 | http_response_code(404); 34 | return view('errors.404'); 35 | } 36 | return null; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Database/ModelMacro.php: -------------------------------------------------------------------------------- 1 | .*)\)/'; 19 | } 20 | 21 | /** 22 | * @param string $template 23 | * @return mixed|string|string[]|null 24 | */ 25 | public function replaceTemplate(string $template) 26 | { 27 | return preg_replace_callback($this->getDirectiveRegexPattern(), static function () { 28 | return null; 29 | }, $template); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Components/Cache/Redis/Event.php: -------------------------------------------------------------------------------- 1 | publish($channel,$data); 24 | } 25 | 26 | /** 27 | * @param Closure $closure 28 | * @param string $channel 29 | */ 30 | public static function subscribe(Closure $closure, string $channel='default'):void 31 | { 32 | Redis::subscribe($channel, $closure); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | bind()->call(new Middleware()); 21 | 22 | if ($globalMiddleware instanceof Request) { 23 | echo (new App()) 24 | ->run() 25 | ->call404IfNotFound(); 26 | } else { 27 | echo $globalMiddleware; 28 | } 29 | 30 | 31 | (new AppShutdown())->onShutdown(); 32 | -------------------------------------------------------------------------------- /src/Application/Middleware/GlobalMiddleware.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 23 | $view = trim($find[1], "'"); 24 | $viewPath = sprintf('src/Views/%s.blade.php', str_replace('.', '/', $view)); 25 | return file_get_contents($viewPath); 26 | }, $template); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/AbstractValidate.php: -------------------------------------------------------------------------------- 1 | input = $input; 31 | $this->optionalInputName = $optionalInputName; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Application/Middleware/GuestMiddleware.php: -------------------------------------------------------------------------------- 1 | check()) { 25 | return $next($request); 26 | } 27 | http_response_code(404); 28 | return view('errors.404'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Components/Blade/CommentDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 28 | return ''; 29 | }, $template); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Components/Cache/Memcache/ViewMemcached.php: -------------------------------------------------------------------------------- 1 | get($name); 23 | } 24 | 25 | /** 26 | * @param string $name 27 | * @param $value 28 | * @param $time 29 | * @return bool|mixed 30 | */ 31 | public function setCache(string $name, $value, $time) 32 | { 33 | return $this->set($name, $value, $time); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Application/Models/Role.php: -------------------------------------------------------------------------------- 1 | belongsToMany(Users::class, 'user_roles', 'role_id', 'user_id'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Components/ToString.php: -------------------------------------------------------------------------------- 1 | string = $string; 20 | } 21 | 22 | /** 23 | * @param $name 24 | * @param $arguments 25 | * @return self 26 | */ 27 | public function __call($name, $arguments) 28 | { 29 | return new self($name($this->string)); 30 | } 31 | 32 | /** 33 | * @return string 34 | */ 35 | public function __toString() 36 | { 37 | return $this->string; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Application/Policies/BookPolicy.php: -------------------------------------------------------------------------------- 1 | id===$book->user_id; 15 | } 16 | 17 | public function create(Users $user, Model $model):?bool 18 | { 19 | // TODO: Implement create() method. 20 | } 21 | 22 | public function delete(Users $user, Model $model):?bool 23 | { 24 | // TODO: Implement delete() method. 25 | } 26 | 27 | public function update(Users $user, Model $model):?bool 28 | { 29 | // TODO: Implement update() method. 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Application/Request/TcNoVerifyRequest.php: -------------------------------------------------------------------------------- 1 | getTypes()[$type]; 24 | return (new $class())->validate($value); 25 | } 26 | 27 | /** 28 | * @return mixed 29 | */ 30 | private function getTypes(): array 31 | { 32 | return array_merge($this->type, (new Validator())->getTypes()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Application/Controllers/Deneme.php: -------------------------------------------------------------------------------- 1 | mustMatchAll(); 20 | 21 | /*$bool->geoShape('location') 22 | ->setCoordinates([[13.0, 53.0], [14.0, 52.0]]) 23 | ->setType('envelope');*/ 24 | 25 | $bool->geoPolygon('location', [ 26 | "40, -70", 27 | "30, -80", 28 | "20, -90" 29 | ]); 30 | 31 | 32 | 33 | return $bool->getDetail(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Container/AppContainer.php: -------------------------------------------------------------------------------- 1 | call(new Request()); 22 | $this->assertInstanceOf(Request::class, $middleware->getResponse()); 23 | } 24 | 25 | public function testCantPassedMiddleware() 26 | { 27 | $middleware = new Middleware('example'); 28 | $middleware->call(new Request()); 29 | $this->assertNotInstanceOf(Request::class, $middleware->getResponse()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /bin/Stubs/migration: -------------------------------------------------------------------------------- 1 | create('$table_name', static function (MigrationBuilder $table) { 17 | $table->primaryKey('id')->length(100)->unique(); 18 | $table->timestamp(); 19 | }); 20 | } 21 | 22 | 23 | /** 24 | * @throws Exception 25 | */ 26 | public function drop():void 27 | { 28 | Schema::connection('default')->drop('$table_name'); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Application/Models/Phone.php: -------------------------------------------------------------------------------- 1 | belongsTo(Users::class, 'user_id'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Components/Pipeline/Pipeline.php: -------------------------------------------------------------------------------- 1 | data = $data; 24 | } 25 | 26 | /** 27 | * @param callable $callable 28 | * @return $this 29 | */ 30 | public function pipe(callable $callable): self 31 | { 32 | $this->data = ($callable($this->data)); 33 | return $this; 34 | } 35 | 36 | /** 37 | * @return mixed 38 | */ 39 | public function process() 40 | { 41 | return $this->data; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/Components/Blade/RemoveSectionDirective.php: -------------------------------------------------------------------------------- 1 | .*)\)\n*(?P.*)\n*@endsection/sU'; 19 | } 20 | 21 | /** 22 | * @param string $template 23 | * @return mixed|string|string[]|null 24 | */ 25 | public function replaceTemplate(string $template) 26 | { 27 | return preg_replace_callback($this->getDirectiveRegexPattern(), static function () { 28 | return null; 29 | }, $template); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/SmallIntMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 24 | $this->column = $column; 25 | $this->connectionName = $connectionName; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Application/Middleware/ThrottleMiddleware.php: -------------------------------------------------------------------------------- 1 | commit(); 28 | if ($throttle->isHasAccessLimit()) { 29 | return $next($request); 30 | } 31 | return abort(403); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Components/Blade/CustomDirective.php: -------------------------------------------------------------------------------- 1 | getDirectiveRegexPattern(), static function ($find) { 26 | if (is_callable($find[1])) { 27 | return sprintf('', $find[1], $find[2]); 28 | } 29 | return $find[0]; 30 | }, $template); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Components/Database/Traits/MigrationDataTypeDestructTrait.php: -------------------------------------------------------------------------------- 1 | table, $this->connectionName, [ 16 | 'column_name' => $this->column, 17 | 'type'=>$this->type, 18 | 'nullable' => $this->isNullable, 19 | 'length' => $this->length ?? null, 20 | 'unique' => $this->isUnique, 21 | 'auto_increment'=>$this->isAutoIncrement ?? false, 22 | 'primary_key'=>$this->isPrimaryKey ?? false, 23 | 'default'=>$this->default, 24 | 'comment'=>$this->comment 25 | 26 | ]); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Interfaces/Autocomplete/PolicyAutocomplete.php: -------------------------------------------------------------------------------- 1 | table = $table; 24 | $this->column = $column; 25 | $this->connectionName = $connectionName; 26 | $this->length=3; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/StringValidate.php: -------------------------------------------------------------------------------- 1 | post($input)); 24 | } 25 | 26 | /** 27 | * @return string 28 | */ 29 | public function message(): string 30 | { 31 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.string')); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Components/Auth/Policy/AbstractPolicy.php: -------------------------------------------------------------------------------- 1 | getPolicies()[$policy] ?? null; 24 | if ($class !==null) { 25 | return new $class(); 26 | } 27 | 28 | throw new PolicyNotFoundException("$policy policy not found"); 29 | } 30 | 31 | /** 32 | * @return array 33 | */ 34 | public function getPolicies():array 35 | { 36 | return $this->policies; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/NumericValidate.php: -------------------------------------------------------------------------------- 1 | post($input)); 24 | } 25 | 26 | /** 27 | * @return string 28 | */ 29 | public function message(): string 30 | { 31 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.numeric')); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Components/NullObject.php: -------------------------------------------------------------------------------- 1 | get($input)); 27 | } 28 | 29 | /** 30 | * @return string 31 | */ 32 | public function message(): string 33 | { 34 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.date')); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Components/Mail/SmtpTransport.php: -------------------------------------------------------------------------------- 1 | transport = (new Swift_SmtpTransport(config('mail.smtp'), config('mail.port'))); 25 | } 26 | 27 | /** 28 | * @return Swift_SmtpTransport 29 | * 30 | */ 31 | public function setConfigs(): Swift_SmtpTransport 32 | { 33 | return $this->transport->setUsername(config('mail.username')) 34 | ->setPassword(config('mail.password')) 35 | ->setEncryption(config('mail.encrypt')); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Components/Auth/User/Logout.php: -------------------------------------------------------------------------------- 1 | get(Enums::USER_AUTH_SESSION_NAME); 25 | $session->delete(Enums::USER_AUTH_SESSION_NAME); 26 | if ($userId) { 27 | Listener::fire('logout', Users::find($userId)); 28 | } 29 | } 30 | 31 | /** 32 | * @param Closure $closure 33 | * @return mixed 34 | */ 35 | public function after(Closure $closure) 36 | { 37 | return $closure(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/Components/Cache.php: -------------------------------------------------------------------------------- 1 | $name(...$arguments); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/View/Master.php: -------------------------------------------------------------------------------- 1 | subject = $subject; 24 | } 25 | 26 | /** 27 | * @param Mail $mail 28 | * @return Mail 29 | */ 30 | public function __invoke(Mail $mail): Mail 31 | { 32 | $mail->setFrom('dilsizkaval@windowslive.com'); 33 | $mail->setSubject($this->subject); 34 | $mail->setBody('lorem upsem dolar'); 35 | $mail->setView(view('index')); 36 | return $mail; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Database/ObserveStorage.php: -------------------------------------------------------------------------------- 1 | pdo(); 28 | //return Connection::make(get_config_array('pdo')[$name])->pdo(); 29 | } 30 | 31 | http_response_code(500); 32 | die(view('errors.general_error', ['error'=>sprintf(self::$message, $name)])); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/EmailValidate.php: -------------------------------------------------------------------------------- 1 | input($input), FILTER_VALIDATE_EMAIL); 25 | } 26 | 27 | /** 28 | * @return string 29 | */ 30 | public function message(): string 31 | { 32 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.email')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Application/Middleware/CaptchaVerifyMiddleware.php: -------------------------------------------------------------------------------- 1 | verify($request->post('_captcha'))) { 27 | return $next($request); 28 | } 29 | return redirect()->back()->withOldInput()->withFormError(Lang::get('captcha.message')); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Components/Route/RouterQueryString.php: -------------------------------------------------------------------------------- 1 | subject = $subject; 24 | } 25 | 26 | /** 27 | * @param Mail $mail 28 | * @return Mail 29 | */ 30 | public function __invoke(Mail $mail): Mail 31 | { 32 | $mail->setFrom('dilsizkaval@windowslive.com'); 33 | $mail->setSubject($this->subject); 34 | $mail->setBody('lorem upsem dolar'); 35 | $mail->setView(view('index')); 36 | return $mail; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Blade/ExtendsDirective.php: -------------------------------------------------------------------------------- 1 | .*)\)/'; 19 | } 20 | 21 | /** 22 | * @param string $template 23 | * @return mixed|string|string[]|null 24 | */ 25 | public function replaceTemplate(string $template) 26 | { 27 | return preg_replace_callback($this->getDirectiveRegexPattern(), static function ($find) { 28 | $viewName = trim($find['view'], "'"); 29 | $viewName=str_replace('.', '/', $viewName); 30 | return file_get_contents("src/Views/$viewName.blade.php"); 31 | }, $template); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/MaxValidate.php: -------------------------------------------------------------------------------- 1 | post($input))<$length); 25 | } 26 | 27 | /** 28 | * @return string 29 | */ 30 | public function message(): string 31 | { 32 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.max')); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/Migration.php: -------------------------------------------------------------------------------- 1 | migrationAttributes = MigrationStorage::all(); 28 | } 29 | 30 | /** 31 | * @return array 32 | */ 33 | public function getPaths(): array 34 | { 35 | return glob($this->path); 36 | } 37 | 38 | /** 39 | * @return array 40 | */ 41 | public function getAttributes(): array 42 | { 43 | return $this->migrationAttributes; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/StringMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 28 | $this->column = $column; 29 | $this->connectionName = $connectionName; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/MinValidate.php: -------------------------------------------------------------------------------- 1 | post($input))>$length); 26 | } 27 | 28 | /** 29 | * @return string 30 | */ 31 | public function message(): string 32 | { 33 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.min')); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/RequiredValidate.php: -------------------------------------------------------------------------------- 1 | hasFile($input) || $request->has($input) || $request->hasFiles($input)); 24 | } 25 | 26 | /** 27 | * @return string 28 | */ 29 | public function message():string 30 | { 31 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.required')); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /bin/Stubs/mail: -------------------------------------------------------------------------------- 1 | subject = $subject; 24 | } 25 | 26 | /** 27 | * @param Mail $mail 28 | * @return Mail 29 | */ 30 | public function __invoke(Mail $mail): Mail 31 | { 32 | $mail->setFrom('dilsizkaval@windowslive.com'); 33 | $mail->setSubject($this->subject); 34 | $mail->setBody('lorem upsem dolar'); 35 | $mail->setView(view('index')); 36 | return $mail; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Application/Queue/ExampleQueue.php: -------------------------------------------------------------------------------- 1 | name = $name; 27 | } 28 | 29 | 30 | /** 31 | * @return mixed|string 32 | */ 33 | public function handle() 34 | { 35 | sleep(10); 36 | return $this->name; 37 | } 38 | 39 | /** 40 | * @param Exception $exception 41 | */ 42 | public function failed(Exception $exception):void 43 | { 44 | // TODO: Implement failed() method. 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Components/Reflection/CodeBeautifier.php: -------------------------------------------------------------------------------- 1 | getFileName(), true); 21 | } 22 | 23 | /** 24 | * @param string $path 25 | * @return string 26 | */ 27 | public static function fromPhpFile(string $path):string 28 | { 29 | return highlight_file($path, true); 30 | } 31 | 32 | /** 33 | * @param string $code 34 | * @return string 35 | */ 36 | public static function fromPhpCode(string $code):string 37 | { 38 | return highlight_string($code, true); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /bin/Components/Process/ExampleProcess.php: -------------------------------------------------------------------------------- 1 | create('roles', static function (MigrationBuilder $table) { 22 | $table->primaryKey('id')->length(100)->unique(); 23 | $table->string('name')->unique(); 24 | $table->timestamp(); 25 | }); 26 | } 27 | 28 | 29 | /** 30 | * @throws Exception 31 | */ 32 | public function drop():void 33 | { 34 | Schema::connection('default')->drop('roles'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Application/Models/Book.php: -------------------------------------------------------------------------------- 1 | name); 41 | } 42 | 43 | /** 44 | * @return string 45 | */ 46 | public function getDefaultName() 47 | { 48 | return 'no names'; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/Application/Queue/SendEmail.php: -------------------------------------------------------------------------------- 1 | setSubject('title mail'); 25 | $mail->setTo('berxudar@gmail.com'); 26 | $mail->attach(__FILE__); 27 | $mail->setBody('message content foo bar '); 28 | $mail->setFrom('dilsizkaval@windowslive.com'); 29 | return $mail->to(); 30 | } 31 | 32 | /** 33 | * @param Exception $exception 34 | */ 35 | public function failed(Exception $exception):void 36 | { 37 | //write or send mail to info for error log 38 | $exception->getMessage(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Components/Cache/Memcache/Memcache.php: -------------------------------------------------------------------------------- 1 | memcache = new Memcached(); 32 | $this->memcache->addServer(config('memcache.host'), config('memcache.port')); 33 | } 34 | 35 | /** 36 | * @param $name 37 | * @param $arguments 38 | * @return mixed 39 | */ 40 | public function __call($name, $arguments) 41 | { 42 | return $this->memcache->$name(...$arguments); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/JsonMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Providers/ServiceProvider.php: -------------------------------------------------------------------------------- 1 | $key = strtoupper($collection->$key); 26 | } 27 | return $collection; 28 | }, $this->collection); 29 | }); 30 | } 31 | 32 | /** 33 | * 34 | */ 35 | public function register(): void 36 | { 37 | Users::observe(UserObserver::class); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /bin/Migrations/user_permission_migration_2020_07_08_00:33.php: -------------------------------------------------------------------------------- 1 | create('user_permissions', static function (MigrationBuilder $table) { 17 | $table->primaryKey('id')->length(100)->unique(); 18 | $table->integer('permission_id'); 19 | $table->integer('user_id'); 20 | $table->timestamp(); 21 | }); 22 | } 23 | 24 | 25 | /** 26 | * @throws Exception 27 | */ 28 | public function drop():void 29 | { 30 | Schema::connection('default')->drop('user_permissions'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/IntegerMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/LongTextMigrationType.php: -------------------------------------------------------------------------------- 1 | table=$table; 31 | $this->column=$column; 32 | $this->connectionName=$connectionName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Traits/ConditionAble.php: -------------------------------------------------------------------------------- 1 | when(!$condition, $callable); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/Components/Auth/Listener.php: -------------------------------------------------------------------------------- 1 | AuthLoginListener::class, 25 | 'logout' => AuthLogoutListener::class, 26 | 'register'=>AuthRegisterListener::class, 27 | ]; 28 | 29 | /** 30 | * @param string $event 31 | * @param $user 32 | * @return mixed 33 | */ 34 | public static function fire(string $event, Model $user) 35 | { 36 | return (new self())->emit($event, $user); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /bin/Migrations/permissions_migration_2020_07_07.php: -------------------------------------------------------------------------------- 1 | create('permissions', static function (MigrationBuilder $table) { 22 | $table->primaryKey('id')->length(100)->unique(); 23 | $table->string('name')->nullable(); 24 | $table->timestamp(); 25 | }); 26 | } 27 | 28 | 29 | /** 30 | * @throws Exception 31 | */ 32 | public function drop():void 33 | { 34 | Schema::connection('default')->drop('permissions'); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/DecimalMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->connectionName = $connectionName; 32 | $this->column = $column; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Message/RedisMessageConsumer.php: -------------------------------------------------------------------------------- 1 | 0)); 20 | $pubSubLoop = $client->pubSubLoop(); 21 | $pubSubLoop->subscribe($channel); 22 | 23 | foreach ($pubSubLoop as $message) { 24 | if ($message->kind==='message') { 25 | $closure($message->payload); 26 | } 27 | } 28 | 29 | unset($pubSubLoop); 30 | $version = redis_version($client->info()); 31 | echo "Goodbye from Redis $version!", PHP_EOL; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/Interfaces/PolicyInterface.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /bin/Migrations/payments_migration_2020_06_08_04:48.php: -------------------------------------------------------------------------------- 1 | create('payments', static function (MigrationBuilder $table) { 21 | $table->primaryKey('id')->length(100)->unique(); 22 | $table->string('name')->unique()->length(112); 23 | $table->timestamp(); 24 | }); 25 | } 26 | 27 | 28 | /** 29 | * @throws Exception 30 | */ 31 | public function drop():void 32 | { 33 | Schema::connection('default')->drop('payments'); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/BigIntegerMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/TextMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | unset($this->length); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/ImageValidate.php: -------------------------------------------------------------------------------- 1 | hasFile($input)) { 26 | return (new File($_FILES[$input]))->isImage(); 27 | } 28 | return false; 29 | } 30 | 31 | /** 32 | * @return string 33 | */ 34 | public function message(): string 35 | { 36 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.image')); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/CallMigrationObjects.php: -------------------------------------------------------------------------------- 1 | getPaths(); 18 | } 19 | 20 | 21 | 22 | public static function create():void 23 | { 24 | foreach (self::getMigrationPaths() as $migrationPath) { 25 | CreateMigrationObject::fromFile($migrationPath)->create(); 26 | } 27 | } 28 | 29 | public static function drop():void 30 | { 31 | foreach (self::getMigrationPaths() as $migrationPath) { 32 | echo CreateMigrationObject::fromFile($migrationPath)->drop(); 33 | } 34 | 35 | echo ColorConsole::getInstance()->getColoredString('command executed', 'green'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/DateTimeMigrationType.php: -------------------------------------------------------------------------------- 1 | length=6; 31 | $this->table = $table; 32 | $this->column = $column; 33 | $this->connectionName = $connectionName; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/MediumTextMigrationType.php: -------------------------------------------------------------------------------- 1 | column = $column; 32 | $this->table = $table; 33 | $this->connectionName = $connectionName; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /test/env/ReadEnvTest.php: -------------------------------------------------------------------------------- 1 | envFile = new EnvFile('.env'); 24 | parent::setUp(); 25 | } 26 | 27 | /** 28 | * 29 | */ 30 | public function testGetValue() 31 | { 32 | $value = $this->envFile->getValue('TEST_EXAMPLE'); 33 | 34 | $this->assertEquals(123456, $value); 35 | } 36 | 37 | /** 38 | * 39 | */ 40 | public function testToArray() 41 | { 42 | $this->assertIsArray($this->envFile->toArray()); 43 | } 44 | 45 | 46 | /** 47 | * @throws JsonException 48 | */ 49 | public function testToJson() 50 | { 51 | $this->assertJson($this->envFile->toJson()); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/Application/Controllers/ImageFormHandleAndResizeTest.php: -------------------------------------------------------------------------------- 1 | whenReturnCallback( 18 | $request->hasFiles('images'), 19 | fn (Request $request) => (new self())->uploadImages($request->files('images')) 20 | ); 21 | } 22 | /** 23 | * @param File[] $files 24 | * @return array 25 | */ 26 | public function uploadImages(array $files): array 27 | { 28 | $uploaded = []; 29 | foreach ($files as $file) { 30 | if ($file->getExtension()==='png') { 31 | $uploaded[] = $file->upload('images')->getUploadedFile(); 32 | } 33 | } 34 | return $uploaded; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MysqlType/BooleanMigrationType.php: -------------------------------------------------------------------------------- 1 | table = $table; 31 | $this->column = $column; 32 | $this->connectionName = $connectionName; 33 | $this->length = 1; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Components/Cache/Redis/ViewRedisCache.php: -------------------------------------------------------------------------------- 1 | redis = Redis::connection(); 25 | } 26 | 27 | /** 28 | * @param string $name 29 | * @return mixed|string 30 | */ 31 | public function getCache(string $name) 32 | { 33 | return $this->redis->get($name); 34 | } 35 | 36 | /** 37 | * @param string $name 38 | * @param $value 39 | * @param $time 40 | * @return mixed 41 | */ 42 | public function setCache(string $name, $value, $time) 43 | { 44 | return $this->redis->set($name, $value, 'ex', $time); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Components/Http/Validate/OptionalImageValidate.php: -------------------------------------------------------------------------------- 1 | hasFile($input)) { 25 | return true; 26 | } 27 | return (new File($_FILES[$input]))->isImage(); 28 | } 29 | 30 | /** 31 | * @return string 32 | */ 33 | public function message(): string 34 | { 35 | return str_replace(':element', $this->optionalInputName ?: $this->input, Lang::get('form.optional_image')); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/Components/Auth/User/AuthEventListener.php: -------------------------------------------------------------------------------- 1 | getEventClass($event); 27 | if ($class !== null) { 28 | return call_user_func([new $class(),'handle'], $user); 29 | } 30 | return null; 31 | } 32 | 33 | /** 34 | * @param string $event 35 | * @return string|null 36 | */ 37 | private function getEventClass(string $event):?string 38 | { 39 | return $this->listener[$event] ?? null; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/Components/Http/FileSize.php: -------------------------------------------------------------------------------- 1 | size = $size; 26 | } 27 | 28 | /** 29 | * @return float|int 30 | */ 31 | public function asKilobyte() 32 | { 33 | return $this->size/1024; 34 | } 35 | 36 | /** 37 | * @return float|int 38 | */ 39 | public function asMegabyte() 40 | { 41 | return $this->size/(1024*1024); 42 | } 43 | 44 | 45 | /** 46 | * @return int 47 | */ 48 | public function asByte() 49 | { 50 | return $this->size; 51 | } 52 | /** 53 | * @return string 54 | */ 55 | public function __toString() 56 | { 57 | return (string)$this->size; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /bin/Migrations/user_roles_migration_2020_07_07.php: -------------------------------------------------------------------------------- 1 | create('user_roles', static function (MigrationBuilder $table) { 23 | $table->primaryKey('id')->length(100)->unique(); 24 | $table->integer('user_id')->nullable(); 25 | $table->integer('role_id')->nullable(); 26 | $table->timestamp(); 27 | }); 28 | } 29 | 30 | 31 | /** 32 | * @throws Exception 33 | */ 34 | public function drop():void 35 | { 36 | Schema::connection('default')->drop('user_roles'); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/Components/Elasticsearch/ModelMapper.php: -------------------------------------------------------------------------------- 1 | $value) { 36 | $model->$key=$value; 37 | } 38 | $model->setAttributes($source); 39 | return $model; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /bin/Migrations/role_permissions_2020_07_07.php: -------------------------------------------------------------------------------- 1 | create('role_permissions', static function (MigrationBuilder $table) { 22 | $table->primaryKey('id')->length(100)->unique(); 23 | $table->integer('permission_id')->nullable(); 24 | $table->integer('role_id')->nullable(); 25 | $table->timestamp(); 26 | }); 27 | } 28 | 29 | 30 | /** 31 | * @throws Exception 32 | */ 33 | public function drop():void 34 | { 35 | Schema::connection('default')->drop('role_permissions'); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /test/router/RouterParameterTypeValidate.php: -------------------------------------------------------------------------------- 1 | validator = new ValidateRouter(); 23 | parent::setUp(); // TODO: Change the autogenerated stub 24 | } 25 | 26 | /** 27 | * 28 | */ 29 | public function testIsInt() 30 | { 31 | $this->assertTrue($this->validator->validate(12, 'int')); 32 | } 33 | 34 | /** 35 | * 36 | */ 37 | public function testIsString() 38 | { 39 | $this->assertTrue($this->validator->validate('hello', 'string')); 40 | } 41 | 42 | public function testIsDate() 43 | { 44 | $this->assertTrue($this->validator->validate('2012-12-12', 'date')); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Components/Route/RouterStorage.php: -------------------------------------------------------------------------------- 1 | getName(), 33 | [ 34 | 'router_url' => $mainRouter->getDynamicUrl(), 35 | 'real_url' => $mainRouter->getUrlPath() 36 | ] 37 | ); 38 | } 39 | 40 | 41 | /** 42 | * @return array|MainRouter[] 43 | */ 44 | public static function all(): array 45 | { 46 | return self::$mainRouter; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/Bootstrap/GlobalMiddlewareLayer.php: -------------------------------------------------------------------------------- 1 | global variable from Middleware class with call closure event protected variable 15 | */ 16 | class GlobalMiddlewareLayer 17 | { 18 | 19 | /** 20 | * @return Closure 21 | */ 22 | public function bind(): Closure 23 | { 24 | return function () { 25 | $request =Request::getInstance(); 26 | /** 27 | * @see Middleware::$global 28 | */ 29 | foreach ($this->global as $middleware) { 30 | if ($request instanceof Request) { 31 | $request = (new $middleware)->handle(fn ($response) => $response, $request); 32 | } else { 33 | break; 34 | } 35 | } 36 | 37 | return $request; 38 | }; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/Components/Database/Migration/MigrationStorage.php: -------------------------------------------------------------------------------- 1 | create('customers', static function (MigrationBuilder $table) { 22 | $table->primaryKey('id')->length(100)->unique(); 23 | $table->integer('city_id'); 24 | $table->string('customer_name')->nullable(); 25 | $table->text('about'); 26 | $table->timestamp(); 27 | }); 28 | } 29 | 30 | 31 | /** 32 | * @throws Exception 33 | */ 34 | public function drop(): void 35 | { 36 | Schema::connection('default')->drop('customers'); 37 | } 38 | } 39 | --------------------------------------------------------------------------------